I'm not sure if this is belongs in the "advanced" section or not, but I am having trouble with scrolling. I got it to scroll fine, however my obstacles that are above 170 on the y axis (I'm not exactly sure what the number value is that is the top of the screen) all pile up at the very top and stay there until my scroll number is high enough. I want them to stay off screen however like in the horizontal scrolling examples and tutorials where the sprites remain off screen and don't pile up on the side. Not sure what to do.
Offline
If y > 150
hide
else
show
Offline
johnnydean1 wrote:
If y > 150
hide
else
show
But I also want it to hide again once it gets gets too low as it piles up there too. If I tell it to hide in both places but show elsewhere it gets confused and blinks rapidly.
Offline
There is an alternative which is probably just as good. simply create a sprite that covers up the bit at the bottom and top. The reason for the problem is that when each sprites ends on the demo it is exactly the same level so you don't get that problem. See my horizontal scrolling game called helicopter game. (I don't know how to create a "link to project" on scratch.
Offline
I think you only need 1 if,else block.
Think about it if its at the top then the block which knows it is at the top will hide it but then then the other if,else block will show it as it isn't at the bottom
Try this code:
<when green flag clicked>
<forever>
<if<<<( <y position> <>>150 )> <or><(<y position> <<> 50 )> >>>
<show>
<else>
<hide>
<end>
Hope it helps.
Offline
subzerostig wrote:
I think you only need 1 if,else block.
Think about it if its at the top then the block which knows it is at the top will hide it but then then the other if,else block will show it as it isn't at the bottom
Try this code:
<when green flag clicked>
<forever>
<if<<<( <y position> <>>150 )> <or><(<y position> <<> 50 )> >>>
<show>
<else>
<hide>
<end>
Hope it helps.![]()
correction:
<forever>
<if<<<( <abs<y position> <>> 150>)
<show>
<else>
<hide>
Last edited by bbbeb (2010-10-05 21:45:48)
Offline