K
Kaijyuu
Guest
hello, good day everyone.
Im having trouble making an object (hot vapor spilling out of an old pite (hurts the player)) to trigger at different times using the same object, I tried coding it like this set a total_time make it reach 0 when that happens my program choses 3 cases (0,1,2) depending on this case timer is set to 30,60 or 80.
now everything works fine until I try to make the timer to go down to 0, no matter what I do it stays in 29,59 or 79 its only substracting 1 but its not looping for it to get to 0 and thus trigerring the hurtin animation of my vapor!
cant get it to loop correctly!
ill post my noob code next:
aditional info: total_timer is set to 300 (that is working fine!)
timer is set in the create event to (-1)
Im having trouble making an object (hot vapor spilling out of an old pite (hurts the player)) to trigger at different times using the same object, I tried coding it like this set a total_time make it reach 0 when that happens my program choses 3 cases (0,1,2) depending on this case timer is set to 30,60 or 80.
now everything works fine until I try to make the timer to go down to 0, no matter what I do it stays in 29,59 or 79 its only substracting 1 but its not looping for it to get to 0 and thus trigerring the hurtin animation of my vapor!
cant get it to loop correctly!
ill post my noob code next:
Code:
image_speed = 0;
if(total_time > 0)
{
total_time = total_time - 1;
if (total_time = 0)
{
time = choose (0,1,2)
switch(time)
{
case 0:
timer = 30;
if (timer > 0)
{
timer = timer - 1;
if (timer = 0)
{
sprite_index = spr_vapor;
image_speed = 1;
if (floor(image_index) == 56)
{
total_time = 300;
}
}
}
break;
case 1:
timer = 60;
if (timer > 0)
{
timer = timer - 1;
if (timer = 0)
{
sprite_index = spr_vapor;
image_speed = 1;
if (floor(image_index) == 56)
{
total_time = 300;
}
}
}
break;
case 2:
timer = 80;
if (timer > 0)
{
timer = timer - 1;
if (timer = 0)
{
sprite_index = spr_vapor;
image_speed = 1;
if (floor(image_index) == 56)
{
total_time = 300;
}
}
}
break;
break;
}
}
}
timer is set in the create event to (-1)
Attachments
-
256.1 KB Views: 4