Page 1 of 1
Extended information for attack results
Posted: Fri Dec 07, 2018 10:41 am
by Gambit37
Two optional parameters on
dsb_attack_text would be great, so something like:
Code: Select all
dsb_attack_text("TEXT", [duration], [other])
Then in
sys_render_attack_result I could just test the value of [other] and respond to it with my own functionality.
Re: Extended information for attack results
Posted: Mon Jan 14, 2019 2:04 am
by Sophia
I revisited this issue in DSB 0.73 and added significantly more flexibility.
DSB 0.73 adds
dsb_attack_info which takes a table as a parameter, as well as a ttl. The table is passed to
sys_render_attack_result which has been rewritten in 0.73 to pass any table parameters passed via
dsb_attack_info on to
h_render_attack_info so you can render them however you like.
For example, if you use the following
h_render_attack_info function:
Code: Select all
function h_render_attack_info(bmp, attack_table)
if (attack_table.graphic) then
dsb_bitmap_draw(attack_table.graphic, bmp, 0, 0, false)
end
end
Then this code would flash a picture of Mophus (the horror...) for 5 ticks.
Code: Select all
dsb_attack_info({ graphic = gfx.port_mophus }, 5)
If a
text property is defined, it will render that text (just like "can't reach" or "need ammo") on top of everything else.
Code: Select all
dsb_attack_info({ graphic = gfx.port_mophus, text = "IT'S MOPHUS" }, 5)
Re: Extended information for attack results
Posted: Mon Jan 14, 2019 9:49 am
by Gambit37
Oooh, nice, that's very flexible. Thanks for improving this.
