Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (Ayumi, 7th_zorro, 1 invisible), 1,060 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Working with multiple entities #162081
10/19/07 13:36
10/19/07 13:36
Joined: Aug 2007
Posts: 17
T
Torr Offline OP
Newbie
Torr  Offline OP
Newbie
T

Joined: Aug 2007
Posts: 17
Is binding an action to multiple entities similar in concept to instantiating? Will each entity have its own copy of all variable within the script and run the functions independently?

If so, is there any way I can watch the variable values for each entity? Such as my.x of 2 entities.

Re: Working with multiple entities [Re: Torr] #162082
10/20/07 06:01
10/20/07 06:01
Joined: Aug 2007
Posts: 17
T
Torr Offline OP
Newbie
Torr  Offline OP
Newbie
T

Joined: Aug 2007
Posts: 17
I don't understand this part of the manual fully.
Quote:

If many instances of the same function are running, which is normally the case with entity actions, each instance uses its own independent set of local variables.



For the code below, if I create 10 entities with the action Bot, would each entity have its own copy of botcount? Or do all 10 share just 1 botcount?
Code:
var botcount = 0;
function BotUpdate()
{
...
botcount = 0;
if (vec_dist(my.x, you.x) < 200)
{
botcount += 1;
}
}
action Bot
{
...
}



Re: Working with multiple entities [Re: Torr] #162083
10/20/07 13:02
10/20/07 13:02
Joined: May 2006
Posts: 398
Bot190 Offline
Senior Member
Bot190  Offline
Senior Member

Joined: May 2006
Posts: 398
that isn't a local variable, im not sure so you should look it up in the manual but i think a variable is made local if its defined in an action.


Wait, there isn't a "Make My Game Now" button?

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1