How to make something bigger when you press a key

i need this urgently

I unfortunately found your question to be awfully vague… It would be nice if you made it clear exactly what you wanted to do by giving diagrams and examples.

Well I will give my attempt in answering your question (assuming I interpreted it correctly): Toggling the character to become either big or small!


First we create a clip named char, who we want to make bigger
image

in the default script, we will create a variable that will allow us to switch between states, a boolean:

//char's default script
this.isBig = false;

Then we add a keypressed script that will switch between states upon pressing a given key.
I used (E) in this case:

if (key === 'e' && this.isBig === false){
/* if E is pressed and this.isBig is false,  set it to true */
    this.isBig = true;

} else if (key === 'e' && this.isBig === true){
/* otherwise set it to false */
    this.isBig = false;
}

Now we have a control prepared, we need to make it actually happen.
We include an update script in the char clip that will do the following things:

  1. check the boolean variable of the character and
  2. set the size of the player’s scaleX and scaleY

we just simply write this:

if (this.isBig === false){
    
    this.scaleX = 1;
    this.scaleY = 1;
} else if (this.isBig === true){
    
    this.scaleX = 2;
    this.scaleY = 2;
    
}

We should get something like this when pressing (E):

GIF 8-29-2021 12-01-33 PM

That’s the fast and simple answer, and you can download the project from here, or do it yourself!

Big toggle.wick (2.1 KB)

1 Like

sorry but that dint helped im tryna make it so that it’s no like a grid thing I’m tryna make it so that everything goes bigger like zoom in when you press a key or hold it and not go either up neither down just zoom to the middle

You mean like this?

GIF 8-29-2021 1-52-26 PM

yeah like that

also a key to make it unzoom that is not the same key

I don’t know why you don’t want it to be the same key when zooming out (given how convenient and
practical it is), but I do know that you need a VCam for this (convenient) and just apply the code I’ve written earlier…

into the VCam…

Although I did modify things a little more appropriately.

inside VCam Default script
inside VCam Update script
inside VCam Keypressed

You just download it here if it’s more convenient for you:

zoom toggle smooth.wick (5.1 KB)

2 Likes

i think he means to make a clip or whatever bigger if you hold a key

1 Like