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

#1 2009-09-04 04:02:33

Implode
Scratcher
Registered: 2009-09-04
Posts: 20

Games

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

 

#2 2009-09-04 06:12:20

Chrischb
Scratcher
Registered: 2008-07-24
Posts: 1000+

Re: Games

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)


I fall: It's a tragedy. You fall: It's comedy.
Hmph enjoy your fall - I get a lovely spring... without pans of new leaves.

Offline

 

#3 2009-09-04 09:59:52

Implode
Scratcher
Registered: 2009-09-04
Posts: 20

Re: Games

Great advice thanks, I will be back to ask more questions im sure.

Thanks

Offline

 

#4 2009-09-04 10:02:23

Implode
Scratcher
Registered: 2009-09-04
Posts: 20

Re: Games

I would like to know why there are no while loops in scratch, had to use loads of if loops, which got really messy.

Offline

 

#5 2009-09-04 11:01:31

Implode
Scratcher
Registered: 2009-09-04
Posts: 20

Re: Games

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

 

#6 2009-09-04 11:32:17

fireball123
Scratcher
Registered: 2008-05-08
Posts: 1000+

Re: Games


I did it for the Lolz

Offline

 

#7 2009-09-05 09:49:51

Implode
Scratcher
Registered: 2009-09-04
Posts: 20

Re: Games

exactly.

Offline

 

#8 2009-09-05 10:42:14

fireball123
Scratcher
Registered: 2008-05-08
Posts: 1000+

Re: Games

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)


I did it for the Lolz

Offline

 

#9 2009-09-05 12:10:38

Implode
Scratcher
Registered: 2009-09-04
Posts: 20

Re: Games

Thanks, I read the tutorial.

Very helpful , thanks for the link. I will start designing the terrains.

Last edited by Implode (2009-09-05 12:10:54)

Offline

 

#10 2009-09-05 12:18:22

Implode
Scratcher
Registered: 2009-09-04
Posts: 20

Re: Games

Another question would be gravity effect.

Offline

 

#11 2009-09-06 04:56:09

Implode
Scratcher
Registered: 2009-09-04
Posts: 20

Re: Games

Also, how would I program a ball to move like in the classic Pong game, how would the ball be able to bounce in the correct angle and keep moving straight after that.

How would the angle be programmed?

Offline

 

Board footer