Variable issue
2 posters
EMS Forums :: Discussion :: Game Maker :: Questions
Page 1 of 1
Variable issue
Greetings mortals and mortalmen...
Well in my RTS game, I have a gas vent.
When the player touches that gas vent it begins building
After an alarm runs out, it turns into a building
When the gas vent is created, the variable stage = 1
When the player touches the gas vent, it goes into stage = 2 and sets an alarm
When this alarm runs out, the stage = 3 and the sprite turns into a built building.
Problem: The alarm doesn't seem to run out and when I test it on debug mode, it says the variable didn't change.
Request code if you want it
Joe
Well in my RTS game, I have a gas vent.
When the player touches that gas vent it begins building
After an alarm runs out, it turns into a building
When the gas vent is created, the variable stage = 1
When the player touches the gas vent, it goes into stage = 2 and sets an alarm
When this alarm runs out, the stage = 3 and the sprite turns into a built building.
Problem: The alarm doesn't seem to run out and when I test it on debug mode, it says the variable didn't change.
Request code if you want it
Joe
Joegernaut- Corporal
- Posts : 78
Join date : 2011-04-18
Age : 27
Location : New Zealand
Re: Variable issue
Yeah, I'll need some code. For all events involved.
Water Chicken- Lieutenant
- Posts : 254
Join date : 2011-03-22
Age : 24
Location : Chandler, Indiana
Re: Variable issue
Obj_Gas
Create event:
Alarm 0:
Alarm 1
Step
Collision with Obj_Workerbot
Create event:
- Code:
stage = 1
image_speed = 0.2
Alarm 0:
- Code:
global.fuel = global.fuel + 100;
instance_create (self.x + 32,self.y + 48,Obj_Workerbot);
working = 0;
Alarm 1
- Code:
instance_create (x+32,y+48,Obj_Workerbot)
stage = 3
Step
- Code:
if stage = 2
{
alarm[1] = 50
sprite_index = Spr_Resource_Building_Being_Built;
image_index=0;
image_speed=1;
}
if stage = 3
{
sprite_index = Spr_Resource_Building
image_index=0;
image_speed=1;
}
Collision with Obj_Workerbot
- Code:
if stage = 1
{
stage = 2
}
if stage = 3
{
if (place_empty(self.x+32,self.y+48))
{
if working = 0
{
alarm[0] = 100
working = 1
with (other) instance_destroy();
instance_create (self.x + 16,self.y,Obj_Making)
}
}
}
Joegernaut- Corporal
- Posts : 78
Join date : 2011-04-18
Age : 27
Location : New Zealand
Re: Variable issue
When checking if stage = 2, add and alarm[1] < 1.
You're constantly setting alarm[1] to 50.
You're constantly setting alarm[1] to 50.
Water Chicken- Lieutenant
- Posts : 254
Join date : 2011-03-22
Age : 24
Location : Chandler, Indiana
EMS Forums :: Discussion :: Game Maker :: Questions
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|