Where i put that code?

Talk about making games.

Where i put that code?

Postby Wertyboy » Tue Sep 14, 2010 3:17 am

Hi, so i put the code when dead where: Create Actor? Draw Actor?
Code: Select all
if(hp=0)
{
Action...
}
User avatar
Wertyboy
 
Posts: 543
Joined: Tue Jun 15, 2010 12:38 pm
Location: HCM City, Vietnam
Score: 44 Give a positive score

Re: Where i put that code?

Postby skydereign » Tue Sep 14, 2010 3:46 am

That would be draw actor, or better yet the event that reduces hp. That way you don't have to check every frame, instead only when the hp is depleted. So if you have a collision event that reduces hp, put it there. Create Actor is only called once, when the actor is created. Draw is every frame.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Where i put that code?

Postby Bee-Ant » Tue Sep 14, 2010 8:20 am

Draw Actor is okay...since there may be so many factors to reduce your HP.
Also, put == inside IF instead of only =
It would cause trouble
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest