K
KitKatarine
Guest
Hello all, I am less-than-pleased-as-punch to say that I am having more difficulty.
I want there to be a delay between clicking a cut icon to the tree actually being, well, cut.
I have tried alarms, and besides not understanding how they work, I have a tendency to lose track of them if they aren't there. (My code is dotted with global variables D: )
I have also tried variables, but for whatever reason, I can't get the variables to do the things I want to do! SO.
This is what my code looks like as of right now:
I saw in another thread from August that I could create variables to help me set a delay. So I tried something along the lines of:
Now it just gets rid of obj_cut.
I am so confused as to what I'm doing wrong. There isn't enough coffee in the world for this! D:
Thank you all so much for any help you might be able to give me~!
I want there to be a delay between clicking a cut icon to the tree actually being, well, cut.
I have tried alarms, and besides not understanding how they work, I have a tendency to lose track of them if they aren't there. (My code is dotted with global variables D: )
I have also tried variables, but for whatever reason, I can't get the variables to do the things I want to do! SO.
This is what my code looks like as of right now:
Code:
if mouse_check_button(mb_left) with instance_place(mouse_x, mouse_y, obj_cut) // if I clicked the cut icon
{
if global.energy > 0 // if player energy is above 0, do this thing
{
with instance_place(obj_cut.x, obj_cut.y + 96, obj_tree) // do this thing with the tree below the cut icon
{
{
// I want to add a timer here for 2 seconds //
instance_change(obj_stump, false); // change to a stump
global.energy = global.energy - 10 // subtract energy
global.wood = global.wood +3 // add 3 wood.
}
}
instance_deactivate_object(obj_cut); // then kill the cut icon.
}
}
Code:
/// Create Event ///
global.countdown = room_speed*2; // This is put in the create event with all the other global variables
Code:
/// STEP EVENT///
if mouse_check_button(mb_left) with instance_place(mouse_x, mouse_y, obj_cut) // if I clicked the cut icon
{
if global.energy > 0 // if player energy is above 0, do this thing
{
with instance_place(obj_cut.x, obj_cut.y + 96, obj_tree) // do this thing with the tree below the cut icon
{
global.countdown = global.countdown - 1 // Which should reduce the amount by 1
if (global.countdown = 0) // This is essentially what was in the other thread.
{
instance_change(obj_stump, false); // change to a stump
global.energy = global.energy - 10 // subtract energy
global.wood = global.wood +3 // add 3 wood.
}
}
instance_deactivate_object(obj_cut); // then kill the cut icon.
}
}
Now it just gets rid of obj_cut.
I am so confused as to what I'm doing wrong. There isn't enough coffee in the world for this! D:
Thank you all so much for any help you might be able to give me~!