How would one program an object which would hold physical space in a scratch stage.
for example
In a game, a character jumps onto , lets say a stone, and the character stays on the stone until it moves off the stone, then it would fall back down.
Another question I would like to ask is how to change stages , lets say the character reaches the end of the stage(scratch stage) then the stage starts to change to the new stage . like in mario bros, when you run to the edge of the screen, the new stage appears.
Would I use the "if touches" method in the scratch library?
Recording high scores. how would I store arrays in scratch??
Thanks in advance
Offline
For the stone question:
You can say:
When Green Flag Clicked
forever
if <not <touching [stone*]> and <not <touching color [Floor Color]>
change y by (Your choice)
For your second question:
You can say this in the character's scripts:
When Green Flag Clicked
forever
if <touching [edge]> and **(x position) > (0)
broadcast [Next background]
Now for the Stage's scripts:
When I recieve [Next background]
next background
For your third question:
Use the variable blocks when neccessary. Have a variable called High Score, and a variable called Score.
At the end of a level, do this in any construction zone; I'd use the Stage...
When I recieve [Level Finished***]
if <(Score) > (High Score)>
set [High Score] to (Score)
*If you're not using a stone sprite, use a color block instead.
**That code isn't pristine, but it messes up my post.
***A broadcast. Name it as you please.
______________________________________
Hope that helps!
Last edited by Chrischb (2009-09-04 06:14:57)
Offline
about the stage, how would i have the stage centered on the player in a platfrom game?
I dont only want it to change when the player gets to the end, and would i need to create the stages ti create the flow, look, or will the coding be able to create the flowing background effect?
Offline
fireball123 wrote:
like this?
http://scratch.mit.edu/projects/fireball123/634824
exactly.
Offline
okay, it's called scrolling.
if you are new I suggest you don't start with scrolling, it is fairly complicated. but if not look up a scrolling tutorial
Last edited by fireball123 (2009-09-05 10:43:43)
Offline