Discord
Login
Community
DARK THEME

plz help click on object

how to make it so that when you click on a sprite then i + 1

I'm on my phone at the moment, so I can't provide much of an example. But check out all the Clicker games in the Explore section, they should give you an idea.

Basically, first you have to check if the mouse is over your sprite (using its position and size).
If that is true you check for the mouse press.

Live Long and Tinker

ok thx

The way i did it is three nested if statements.

if y < mousey and y1 > mousey then

   if x < mousex and x1 > mousey
  
      if mouse.click then
     
         i+1
  
      end

   end

end

This is psuedo-code but it looks pretty close to this.

Edit: forgot to say that the x has to be less than the x1 and same as the y and y1

Oh thx🤔

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community