click the object once game maker studio

Information about object: obj_ghost

Sprite: spr_ghost

Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object

Create Event:

execute code:

clicked=false;
score=0;
x=random(room_width);//jump to random position
y=random(room_height);//jump to random position
image_index=0;
image_speed=0.5;
Step Event:
execute code:

//jump to new position on animation end

if floor(image_index)==29//if animation complete
{
clicked = false
x=random(room_width);//jump to random position
y=random(room_height);//jump to random position
image_index=0;
image_speed=0.5;
}
//add to score if clicked
if position_meeting(mouse_x,mouse_y,id) && mouse_check_button_pressed(mb_left)//if mouse clicked over object
{
if(!clicked){   
score+=1;
clicked = true
}
}

Draw GUI Event:

execute code:

draw_text(10,10,score);//draw score
































No comments:

Renowned Water Expert Reynold Aquino Offers Exclusive Water Softener Discounts

Los Angeles, California - November 21, 2024 - World-renowned water expert Reynold Aquino is excited to announce exclusive discounts on prem...

Contact Form

Name

Email *

Message *