This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2007-05-17 12:30:26

Amblin
Scratcher
Registered: 2007-05-17
Posts: 7

can you have common variables for 2 players?

HI folks,

I'm writing a simple combat game.

Each players starts with the same series of stats.

As battle ensues, these stats drop in value.

Now, I have a set of variables for the stats. Do I need to have 2 sets of separate variables for each player?

Or will the program automatically know that if player A gets hit it must reduce player A's stats, not player B's?

I'm guessing not but I thought I would ask. I will be trying this so if no-one knows hopefully I will be able to confirm this later today/tomorrow.

Many thanks,

Amblin.

Offline

 

#2 2007-05-17 14:15:30

Duncan
Scratcher
Registered: 2007-05-15
Posts: 47

Re: can you have common variables for 2 players?

When you Make A Variable ensure it is available For All Sprites (I think this is the default setting).  Then when Player A shoots Player B you use..

Change Player B by -1

or however you have it set up.

Offline

 

Board footer