How to make it so if you click sprite, it enlarges then return to normal size.

ManOfHoops

Member
Hello, I am using DND (Drag and Drop) for this project, I am making cookie-alike clicker game but I can't figure out how to make sprite enlarge and return to original size.


----------------------------------------------------------------
Here's screenshot, and honestly it should work,
I don't see anything wrong with it or am I wrong?

Screenshot.png
 

Pixel-Team

Master of Pixel-Fu
A sprite is at its actual size at 1.0 horizontal and 1.0 vertical. So if you want to scale it up, you'd go 1.2 in both the horizontal and vertical When you want to return to actual size again, you'd use 1.0 for both again.
 

TsukaYuriko

☄️
Forum Staff
Moderator
Here's screenshot, and honestly it should work,
You wish it would, but it shouldn't. Setting an alarm will not halt code execution to wait for that alarm to expire. Check the manual to find out how to work with alarms if you haven't already.
 

FrostyCat

Redemption Seeker
Move the last Set Instance Scale action to the Alarm 1 event. Actions delayed by an alarm belong and happen in the corresponding Alarm event.

Also, alarms work in frames, not seconds. You should set it to 12 if you know the frame rate is always 60, or 0.2*room_speed for generality.

This is all material that you could have picked up from the Manual page for the Set Alarm action.

I strongly recommend that you follow an up-to-date tutorial from this page to master the basic mechanics first. At the very least, learn how the events, resource types, and the most common actions work.
 

ManOfHoops

Member
Move the last Set Instance Scale action to the Alarm 1 event. Actions delayed by an alarm belong and happen in the corresponding Alarm event.

Also, alarms work in frames, not seconds. You should set it to 12 if you know the frame rate is always 60, or 0.2*room_speed for generality.

This is all material that you could have picked up from the Manual page for the Set Alarm action.

I strongly recommend that you follow an up-to-date tutorial from this page to master the basic mechanics first. At the very least, learn how the events, resource types, and the most common actions work.
image_xscale += 1;
image_yscale += 1;

image_blend = $FFF138FF & $ffffff;
image_alpha = ($FFF138FF >> 24) / $ff;

alarm_set(1, 12 + alarm_get(1));

image_xscale += -0.9;
image_yscale += -0.9;

Like this? Uhhh, I am not sure how to do that exactly.
 

Nidoking

Member
If you do this:

Set x to 5
Set x to 10

What is the value of x? It's 10. It doesn't matter that you set it to 5, because you immediately set it to 10, and now the 5 is gone forever.

You're doing the same thing. Setting an alarm does not pause the game and wait. It sets an alarm which will then count down steps while your game does other things. You want the last part to happen when the alarm goes off, not immediately. The Manual pages you were linked, and the posts you've read in this thread, tell you how to do that. But you have to read those things and think instead of just posting the same thing that didn't work and saying you don't understand. Understanding is a very important part of the learning process, and nobody can do that for you. Meet the community halfway. Try to do a learning.
 
Top