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

#1 2011-08-18 18:18:25

Thescratch3
Scratcher
Registered: 2011-06-14
Posts: 1000+

Hiding Terrains in Scrolling

Hey guys you know in Scratch Wiki it says to do When Flag Clicked Forever If absolute value of x position greater than 480 hide else show? Well this technique does not work well. If you are scrolling across with 480 size, use this instead. The exact same script but instead of greater than 480 put 300. It works as soon as the player is on to another platform or is away from the other one. It works well!


View my projects. Or face The scratch curse! (Get it?)
http://i56.tinypic.com/2cdk8hy.png

Offline

 

#2 2011-08-18 18:24:00

ImagineIt
Scratcher
Registered: 2011-02-28
Posts: 1000+

Re: Hiding Terrains in Scrolling

It works better with 460 to me.

Offline

 

#3 2011-08-18 18:57:08

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Hiding Terrains in Scrolling

ImagineIt wrote:

It works better with 460 to me.

It shouldn't - Scratch screens are 480 pixels wide. Thus 480 is the optimal screen size. Anything less than that, and the screens will overlap eachother; anything more than that, you'll get large gaps between them.

Offline

 

#4 2011-08-18 19:19:10

ImagineIt
Scratcher
Registered: 2011-02-28
Posts: 1000+

Re: Hiding Terrains in Scrolling

coolstuff wrote:

ImagineIt wrote:

It works better with 460 to me.

It shouldn't - Scratch screens are 480 pixels wide. Thus 480 is the optimal screen size. Anything less than that, and the screens will overlap eachother; anything more than that, you'll get large gaps between them.

yeah, but sometimes they don't go to 481 or -481.

Offline

 

#5 2011-08-18 19:45:05

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Hiding Terrains in Scrolling

ImagineIt wrote:

coolstuff wrote:

ImagineIt wrote:

It works better with 460 to me.

It shouldn't - Scratch screens are 480 pixels wide. Thus 480 is the optimal screen size. Anything less than that, and the screens will overlap eachother; anything more than that, you'll get large gaps between them.

yeah, but sometimes they don't go to 481 or -481.

Ah, yes! It should be 240, then.

Offline

 

#6 2011-08-18 20:06:29

Thescratch3
Scratcher
Registered: 2011-06-14
Posts: 1000+

Re: Hiding Terrains in Scrolling

coolstuff wrote:

ImagineIt wrote:

coolstuff wrote:


It shouldn't - Scratch screens are 480 pixels wide. Thus 480 is the optimal screen size. Anything less than that, and the screens will overlap eachother; anything more than that, you'll get large gaps between them.

yeah, but sometimes they don't go to 481 or -481.

Ah, yes! It should be 240, then.

240? 300 worked best for me.


View my projects. Or face The scratch curse! (Get it?)
http://i56.tinypic.com/2cdk8hy.png

Offline

 

#7 2011-08-18 20:13:57

ImagineIt
Scratcher
Registered: 2011-02-28
Posts: 1000+

Re: Hiding Terrains in Scrolling

I still like 460.

Offline

 

#8 2011-08-18 21:30:06

Thescratch3
Scratcher
Registered: 2011-06-14
Posts: 1000+

Re: Hiding Terrains in Scrolling

ImagineIt wrote:

I still like 460.

Does it even work?


View my projects. Or face The scratch curse! (Get it?)
http://i56.tinypic.com/2cdk8hy.png

Offline

 

#9 2011-08-19 07:15:16

EdnaC
Scratcher
Registered: 2007-08-28
Posts: 100+

Re: Hiding Terrains in Scrolling

If you use a specific position to decide when to hide, you have to experiment, because it will depend on the sprite's size.  (Character sprites that go off-screen have to hide too.) 

I use this technique;  set a variable (CommandX) to where the sprite needs to go, then "Set X to (CommandX)".  Then check the absolute value of the difference between CommandX and Xposition;  If this is greater than 1, the sprite couldn't go where you told it to go and should hide, else it is still on screen and should show.

Offline

 

#10 2011-08-19 11:46:01

Thescratch3
Scratcher
Registered: 2011-06-14
Posts: 1000+

Re: Hiding Terrains in Scrolling

EdnaC wrote:

If you use a specific position to decide when to hide, you have to experiment, because it will depend on the sprite's size.  (Character sprites that go off-screen have to hide too.) 

I use this technique;  set a variable (CommandX) to where the sprite needs to go, then "Set X to (CommandX)".  Then check the absolute value of the difference between CommandX and Xposition;  If this is greater than 1, the sprite couldn't go where you told it to go and should hide, else it is still on screen and should show.

No offense but it seems you do a lot of stuff in a more complicated way.


View my projects. Or face The scratch curse! (Get it?)
http://i56.tinypic.com/2cdk8hy.png

Offline

 

#11 2011-08-19 13:35:52

EdnaC
Scratcher
Registered: 2007-08-28
Posts: 100+

Re: Hiding Terrains in Scrolling

I'd say that this "complicated way" pays off - It's really not that much (two variables); and once you make the script in one sprite, you just drop it into the others - and it works whether the sprite is a small bullet or a big landscape.  If you look at the enemy sprites in AsteroidBattle, you'll see that they are all identical except for the two variables (angle and radius) that specify their "World Location".

To each his own, I suppose, but if you use a specific number, and get it working, then change the sprite's costume, the hiding might stop working correctly - I know, because I've been there and done that...

Offline

 

#12 2011-08-19 13:37:46

JJROCKER
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: Hiding Terrains in Scrolling

At first, I thought you meant you want to make a terrain invisible  tongue  in that case, make it and make it 99.999 ghost effect  smile


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://img255.imageshack.us/img255/3491/signature1y.jpg&link2=http://img577.imageshack.us/img577/5272/signature1sx.jpg&link3=http://img4.imageshack.us/img4/8514/signature1et.jpg&link4=http://i.imgur.com/POEpQyZ.png&link5=http://img163.imageshack.us/img163/4640/jjrockerfinal.jpg

Offline

 

#13 2011-08-19 13:55:16

Thescratch3
Scratcher
Registered: 2011-06-14
Posts: 1000+

Re: Hiding Terrains in Scrolling

JJROCKER wrote:

At first, I thought you meant you want to make a terrain invisible  tongue  in that case, make it and make it 99.999 ghost effect  smile

Make it and make it?


View my projects. Or face The scratch curse! (Get it?)
http://i56.tinypic.com/2cdk8hy.png

Offline

 

#14 2011-08-19 13:56:32

JJROCKER
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: Hiding Terrains in Scrolling

Thescratch3 wrote:

JJROCKER wrote:

At first, I thought you meant you want to make a terrain invisible  tongue  in that case, make it and make it 99.999 ghost effect  smile

Make it and make it?

Lol, I meant make the sprite and then make it 99.999  ghost effect  tongue


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://img255.imageshack.us/img255/3491/signature1y.jpg&link2=http://img577.imageshack.us/img577/5272/signature1sx.jpg&link3=http://img4.imageshack.us/img4/8514/signature1et.jpg&link4=http://i.imgur.com/POEpQyZ.png&link5=http://img163.imageshack.us/img163/4640/jjrockerfinal.jpg

Offline

 

Board footer