Quote:
Originally Posted by jediaction
I gave you a link to the game. I have never done the method way for shooting detection and stuff. Ive always done with events, can you make aa example of a event way, and a method way. Ive seen it buy i dont now any games that I could look at
|
Say you have a bullet b that in some part of the game is shot into a target t, and a shooting event calling method During_Shoot (that's a method I saw in your world)
method: During_Shoot
<do Ammo calc and fire stuff>
b.is_flying=true
b.moveToPosition(...)
...
# event testing for hit
event: while b.is_flying and b.isCloseTo(1 meter, t)
<do the hit effect>
<set b.is_flying to false>
Checking first for the boolean value b.is_flying is not expensive, and while it is false the second condition is not checked (short-circuit).