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

#26 2012-08-21 17:22:01

gooeygoo
Scratcher
Registered: 2012-05-07
Posts: 82

Re: Varibles X and Y

sonicfan12p wrote:

The x y velocity variables control movement, makes it look smooth, and can be used to generate gravity or momentum. But background changing doesn't really have much to do with those variables. For back grounds, make a field, such as this one,

when gf clicked
forever
if < ([background # v] of [Stage v]) = [10] >
if <<<< (x position) > [240]> and < (y position)> [100]>> and <  (y position) < [160]>>
switch to background [random background v]
else
if <<<< (x position) > [240]> and < (y position)> [-160]>> and <  (y position) < [-100]>>
switch to background [random background 2 v]
end
end
end
This will give you a high route, and a low route.

Oh and, Is this for the stage, or a sprite, becaus eI'm using a sprite.


Play meh games, dont beh shy!!!
http://scratch.mit.edu/users/gooeygoo

Offline

 

#27 2012-08-21 17:37:56

sonicfan12p
Scratcher
Registered: 2011-11-16
Posts: 1000+

Re: Varibles X and Y

gooeygoo wrote:

sonicfan12p wrote:

The x y velocity variables control movement, makes it look smooth, and can be used to generate gravity or momentum. But background changing doesn't really have much to do with those variables. For back grounds, make a field, such as this one,

when gf clicked
forever
if < ([costume # v] of [Background Sprite v]) = [10] >
if <<<< (x position) > [240]> and < (y position)> [100]>> and <  (y position) < [160]>>
switch to costume [random background v]
else
if <<<< (x position) > [240]> and < (y position)> [-160]>> and <  (y position) < [-100]>>
switch to costume [random background 2 v]
end
end
end
This will give you a high route, and a low route.

Oh and, Is this for the stage, or a sprite, because I'm using a sprite.

Well, it was for the stage. But The one above is now for a sprite.

Last edited by sonicfan12p (2012-08-21 17:38:16)


Why are the secret organizations getting all the attention?  mad

Offline

 

#28 2012-08-21 17:52:14

gooeygoo
Scratcher
Registered: 2012-05-07
Posts: 82

Re: Varibles X and Y

Ah, ok. That helps. but how will it work?


Play meh games, dont beh shy!!!
http://scratch.mit.edu/users/gooeygoo

Offline

 

#29 2012-08-21 17:57:27

beyblade4
Scratcher
Registered: 2011-08-02
Posts: 1000+

Re: Varibles X and Y

gooeygoo wrote:

Ok, I think I have the hang of it, but I need help, Theres some glitch that when you move to background 2, you sometimes get stuck in the ground

You have to set the right X and Y position when you go to a new location


http://blocks.scratchr.org/API.php?user=beyblade4&amp;action=projects&amp;type=newest&amp;return=image&amp;num=NUMBER

Offline

 

#30 2012-08-21 19:00:19

sonicfan12p
Scratcher
Registered: 2011-11-16
Posts: 1000+

Re: Varibles X and Y

gooeygoo wrote:

Ah, ok. That helps. but how will it work?

What it does, is when you get to a certain part of the level, in this case, costume number 10, it checks to see if you are at the far right edge of the screen. If you are, it uses the y position to determine if you are taking the upper route, or lower route, the switches to the appropriate costume.


Why are the secret organizations getting all the attention?  mad

Offline

 

#31 2012-08-21 19:10:47

gooeygoo
Scratcher
Registered: 2012-05-07
Posts: 82

Re: Varibles X and Y

That's great! but How do I make the player go from one end to the other?
like from left to right.


Play meh games, dont beh shy!!!
http://scratch.mit.edu/users/gooeygoo

Offline

 

Board footer