View Single Post
Old
meirs
Senior Member
 
meirs's Avatar
 
Status: Offline
Posts: 64
Join Date: Dec 2009
Location: Universe
Post 03-12-2010, 02:54 AM

Quote:
Originally Posted by jediaction View Post
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).


Mama is an Alice On Steroids with YouTube uploader, 3d object creator, tutorial editor, and standalone support:
http://www.eytam.com/mama

Last edited by meirs; 03-13-2010 at 01:24 AM.
   
Reply With Quote