• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

How to work variables

R

Rosepike

Guest
Hello, I'm currently working on a university project and have been advised to use variables to achieve the goals I want for my project.

However, the problem is that I don't know how to set them up or how to work them.

For my game, I want my character to possess certain abilities when he attacks an enemy with a special attack.
When he does this, I want the character to change sprite into the enemy where he will then gain abilities from the enemy.

Up to now I have done the following;
global.Meele= 0;
global.double_jump= 0;
global.scientist= 0;
global.Electricity: 0;

How do I set what happens to each variable when they are true?


I hope this makes sense. I am new to the software so I apologize if none of this makes sense.
Thank you :)
 
Z

zendraw

Guest
everything below 0.5=false
0.5+ anything above=true

you can simply change them betwean 0 or 1
or -1/1
so when a change happens do this
global.melee=-global.melee
 
R

Rosepike

Guest
everything below 0.5=false
0.5+ anything above=true

you can simply change them betwean 0 or 1
or -1/1
so when a change happens do this
global.melee=-global.melee
How do i set what happens in each variable? Do i do this in script or in the player object?
 
Z

zendraw

Guest
if (global.melee)//if melee is 0, you cant do it, if its 1 you can
{
do melee
}
 
Top