This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-03-23 13:24:14

rand1
New Scratcher
Registered: 2012-03-07
Posts: 5

Speed set trouble

My next game has a ball. How DO I change its speed at will and at anytime? I already have made a slider variable for it.

yikes   hmm

Offline

 

#2 2012-03-23 14:29:28

LiquidMetal
Scratcher
Registered: 2011-06-15
Posts: 500+

Re: Speed set trouble

There are many ways to do this, but here is a very basic one to start with:

move (speed) steps
wait (1) secs
Or you could try:

move (10) steps
wait <(1)- <(speed)/(10)> > secs
Good luck!

Last edited by LiquidMetal (2012-03-23 14:37:45)

Offline

 

#3 2012-03-23 15:05:52

turkey3
Scratcher
Registered: 2011-12-04
Posts: 500+

Re: Speed set trouble

Make a variable. Say you name it "whatever". Then, you can change "whatever" based on what you want it to change to. For example:

When [g] key pressed
Set [whatever v] to (5)
Then, in the ball sprite you do something like this:
When gf clicked
Forever
Move (whatever) steps
This way, whatever you set "whatever" to the ball moves that amount of steps.

Last edited by turkey3 (2012-03-23 16:20:18)

Offline

 

#4 2012-03-23 16:28:21

Indiego
New Scratcher
Registered: 2012-02-27
Posts: 61

Re: Speed set trouble

The easiest way to do this would be to put something like this in:

when gf clicked 
set [speed v] to [the default speed]
and then in the blocks where you have it saying how many steps to move/what to change the x/y by when a key is pressed put in the speed variable block, so this way whatever the speed is set to is the amount the ball moves by  smile

Offline

 

#5 2012-03-24 11:52:52

rand1
New Scratcher
Registered: 2012-03-07
Posts: 5

Re: Speed set trouble

LiquidMetal wrote:

There are many ways to do this, but here is a very basic one to start with:

move (speed) steps
wait (1) secs
Or you could try:

move (10) steps
wait <(1)- <(speed)/(10)> > secs
Good luck!

Thanks!

big_smile

Offline

 

Board footer