Quick types question
Blitz3D Forums/Blitz3D Programming/Quick types question
| ||
I have been successfully using types for some time now, but would like some help with this if possible. Assume I create 10 "things" using types EASY I then want to apply common parameters to all types, run,jump etc EASY But suppose I want to shoot each type 4 times before it disappears?? Well I shoot it 4 times and it disappears, I shoot it 3 times and it does not disappear, but the next type I shoot dies after 1 shot, 3 + 1 = 4 Is there a way to keep track of things like this for each type ? |
| ||
You just need a field for tracking number of hits: ; Been hit... ship\hits = ship\hits + 1 If ship\hit = 4 Then Die () |
| ||
I think you have to use an identifier, like n.enemy = new enemy n\hits = 4 After you're guy is hit, identify which one it was (n), and do n\hits = n\hits - 1 if n\hits = 0 enemydead=true delete n end if something like that. But I'm still a Blitz newbie, so don't get angry with me if it doesn't work :) |