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

#1 2012-07-17 16:03:22

hello12345678910
Scratcher
Registered: 2009-07-11
Posts: 100+

Rotational Scrolling

Ok. I have a 2x2 scrolling background [which may need to be expanded] and I need to be able to rotate the world at any angle around the player. kind of like a "and yet it moves" type game if you've ever played that game for the wii. problem is, and can't get the four backgrounds to line up correctly and move in unison. also, when i change the angle, the player moves in a circle relative to the ground, instead of a rotation around a single point.
please help, I'm posting this in AT because i won't get any help in help with scripts.


http://tinyurl.com/8yt32o9 http://tinyurl.com/6tgwp5r || Fish = F+I+S+H = 6+9+19+8 = 42<<The answer to Life, the Universe and Everything

Offline

 

#2 2012-07-17 16:29:18

hello12345678910
Scratcher
Registered: 2009-07-11
Posts: 100+

Re: Rotational Scrolling

i don't believe in bumping, so i post this instead.


http://tinyurl.com/8yt32o9 http://tinyurl.com/6tgwp5r || Fish = F+I+S+H = 6+9+19+8 = 42<<The answer to Life, the Universe and Everything

Offline

 

#3 2012-07-17 17:47:09

chanmanpartyman
Scratcher
Registered: 2011-05-30
Posts: 500+

Re: Rotational Scrolling

Are you using trig as a base for your scrolling? With rotational scrolling, it's the only way.

Offline

 

#4 2012-07-18 06:59:38

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: Rotational Scrolling

Try something like this:

http://i.imgur.com/mDQTJ.png

I'm still trying to figure out how to rotate around a certain point.  hmm


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#5 2012-07-18 08:38:50

SciTecCf
Scratcher
Registered: 2011-11-23
Posts: 1000+

Re: Rotational Scrolling

Hmm... I don't really see how this belongs in Advanced Topics as the solution I'm thinking of is quite simple. All you need to do is set the center of each costume to the point you want it to rotate around, and then just set the x to scrollx, y to scrolly, and rotation to rotation.


http://bit.ly/LCZEJRhttp://bit.ly/LSONcOhttp://bit.ly/LF3vIc
http://trinary.site40.net/images/scratchrank.php?username=SciTecCf&amp;display=small

Offline

 

#6 2012-07-18 09:53:21

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: Rotational Scrolling

SciTecCf wrote:

Hmm... I don't really see how this belongs in Advanced Topics as the solution I'm thinking of is quite simple. All you need to do is set the center of each costume to the point you want it to rotate around, and then just set the x to scrollx, y to scrolly, and rotation to rotation.

That doesn't rotate the whole level, though. They wouldn't rotate together; each sprite would just rotate around its individual center.

I think the OP wanted to be able to rotate the level, ie. multiple sprites, in unison around any point.


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#7 2012-07-18 10:24:11

SciTecCf
Scratcher
Registered: 2011-11-23
Posts: 1000+

Re: Rotational Scrolling

blob8108 wrote:

SciTecCf wrote:

Hmm... I don't really see how this belongs in Advanced Topics as the solution I'm thinking of is quite simple. All you need to do is set the center of each costume to the point you want it to rotate around, and then just set the x to scrollx, y to scrolly, and rotation to rotation.

That doesn't rotate the whole level, though. They wouldn't rotate together; each sprite would just rotate around its individual center.

I think the OP wanted to be able to rotate the level, ie. multiple sprites, in unison around any point.

I know, I mean, as in

wx
yz

Center for w:

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxo

Center for x:

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


http://bit.ly/LCZEJRhttp://bit.ly/LSONcOhttp://bit.ly/LF3vIc
http://trinary.site40.net/images/scratchrank.php?username=SciTecCf&amp;display=small

Offline

 

#8 2012-07-18 12:33:49

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: Rotational Scrolling

It's a thought. You wouldn't be able to make the level very big, though.


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#9 2012-07-25 17:30:45

hello12345678910
Scratcher
Registered: 2009-07-11
Posts: 100+

Re: Rotational Scrolling

blob8108 wrote:

Try something like this:

http://i.imgur.com/mDQTJ.png

I'm still trying to figure out how to rotate around a certain point.  hmm

YES! thats it. thats the script I've been using, just without the offset. I've been trying to calculate the offset using trig and the scrollx,scrolly, and direction variables but turns out it's just constant. thanks blob81o8
EDIT: Wait, doesn't work. looks good rotating around the origin, but anywhere else it goes in a circle. back to the original problem. and SciTecCf, thats a good idea, but its more of a simplistic version of blob's trig.

Last edited by hello12345678910 (2012-07-25 17:46:38)


http://tinyurl.com/8yt32o9 http://tinyurl.com/6tgwp5r || Fish = F+I+S+H = 6+9+19+8 = 42<<The answer to Life, the Universe and Everything

Offline

 

#10 2012-07-26 00:39:38

SciTecCf
Scratcher
Registered: 2011-11-23
Posts: 1000+

Re: Rotational Scrolling

Well, you could experiment: Try using the move () steps block as a substitute for trig. This for me is much easier to understand, and it calculates it's positions inside a forever, meaning it doesn't change much for the player. You can see an example here.

Last edited by SciTecCf (2012-07-26 00:40:17)


http://bit.ly/LCZEJRhttp://bit.ly/LSONcOhttp://bit.ly/LF3vIc
http://trinary.site40.net/images/scratchrank.php?username=SciTecCf&amp;display=small

Offline

 

#11 2012-07-26 04:11:17

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: Rotational Scrolling

hello12345678910 wrote:

looks good rotating around the origin, but anywhere else it goes in a circle.

Yeah, I know — this is what I meant by saying:

blob8108 wrote:

I'm still trying to figure out how to rotate around a certain point.


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

Board footer