actor count

Talk about making games.

actor count

Postby raminjoon » Sun Jul 31, 2011 12:19 am

Hi i was wondering to know how can I set a amount on a weapon. like let say I got 10 apples so after I used up all ten I want it to set the number text to 0. how?
raminjoon
 
Posts: 40
Joined: Tue Jul 05, 2011 5:34 am
Location: Denver, Co.
Score: 3 Give a positive score

Re: actor count

Postby JamesLeonardo32 » Sun Jul 31, 2011 12:40 am

If you make a vairable named apple, then colecting the apple should have a code like:

Code: Select all
apple+=1; // add one apple


And most likely touching the apple will result in destroying the apple actor.

So now if you want to use the apple, a code such as:

Code: Select all
if (apple>=1) // if you have more than one
{
apple-=1;  //takes away one

// Your special code for throwing the apple.

}


Renember the actor apple should have a diffrent name to the vairable, eg: Actor, Apple - Vairable, apple (Cap first letter)

I hope this helps.

(Please reply back to let me know if this helps! :wink: )
JamesLeonardo32
 
Posts: 320
Joined: Wed Oct 13, 2010 4:57 pm
Score: 36 Give a positive score

Re: actor count

Postby skydereign » Sun Jul 31, 2011 12:48 am

If you want the number of existing actors, just use ActorCount. This code will make the text actor display how many apples exist.
apple_num -> Draw Actor -> Script Editor
Code: Select all
textNumber=ActorCount("apple");
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest