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

#1 2010-06-30 15:41:59

explosivedude
Scratcher
Registered: 2010-06-22
Posts: 64

platformer help

im making a platformer game and i need help every time i get it to switch to level 2 my character falls through the floor and i can't seem to figure out how to make him stay on the ground. by the way the floor he is on is over somthing. can you please help me

Offline

 

#2 2010-06-30 16:29:40

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

Re: platformer help

Try sending him to a new location on the screen (above the floor) - if the floor is at a different height than before, it can get a little buggy.

Offline

 

#3 2010-06-30 16:36:09

explosivedude
Scratcher
Registered: 2010-06-22
Posts: 64

Re: platformer help

that didnt work he fell right through the floor again..

Offline

 

#4 2010-06-30 16:39:21

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

Re: platformer help

Can you tell me how your scripts are working, or better yet, upload the project so I can take a look at it?

Offline

 

#5 2010-06-30 17:19:11

explosivedude
Scratcher
Registered: 2010-06-22
Posts: 64

Re: platformer help

okay im about to upload it right now

Offline

 

#6 2010-06-30 17:34:12

Greentabby55
Scratcher
Registered: 2010-05-04
Posts: 50

Re: platformer help

Ah, here's the problem.

This is a script you have:

<when I receive[ next level
<go to x sad  -214 )y sad  -30 )>
<forever if><<  <not>  ><touching[ sprite 4>
   <change y by( 7 )>
<end>

That should be changed to:

<when I receive[ next level
<go to x sad  -214 )y sad  -30 )>
<forever>
   <if><<  <not>  ><touching[ sprite 4>
      <change y by( -7)>
   <end>
<end>

Offline

 

#7 2010-06-30 18:28:00

explosivedude
Scratcher
Registered: 2010-06-22
Posts: 64

Re: platformer help

Greentabby55 wrote:

Ah, here's the problem.

This is a script you have:

<when I receive[ next level
<go to x sad  -214 )y sad  -30 )>
<forever if><<  <not>  ><touching[ sprite 4>
   <change y by( 7 )>
<end>

That should be changed to:

<when I receive[ next level
<go to x sad  -214 )y sad  -30 )>
<forever>
   <if><<  <not>  ><touching[ sprite 4>
      <change y by( -7)>
   <end>
<end>

uhm it didn't fix it....

Offline

 

#8 2010-06-30 19:18:03

icypenguinis
New Scratcher
Registered: 2010-06-22
Posts: 9

Re: platformer help

You see, the problem is this script:

<when green flag clicked>
<forever if> <<  <not>  >><touching[ Sprite2
<change y by( -7
<move( 3 )steps>
<end>

Although it is only intended to apply in the first level, it runs in the second level as well. Since Sprite2 is hidden however, the character indefinitely has its y changed by -7. To fix this, create a variable called level to specify what should be occurring in each level.

Offline

 

#9 2010-06-30 19:38:25

Locomule
Scratcher
Registered: 2009-08-24
Posts: 500+

Re: platformer help

The problem is in the Sprite1 script, this block...
forever if not touching Sprite2 change y by -7 move 3 steps

Sprite2 is the floor from the first level. It disappears when you run onto the 2nd level but the script keeps checking to see if the player is on it. You need to make it only check for floor one on level one, floor 2 on level 2, etc. Just some If statements and a level variable would suffice.

How I found it... I started the game normally, ran to just before the edge of level one, put the game in single step mode, then ran into level 2 and watched what part of the script was active when the sprite fell through the floor. Peace  smile


aka Pain from DragonSpires, Delrith Online, BotBattle, Urban Dead etc etc lol

Offline

 

#10 2010-07-02 19:58:25

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

Re: platformer help

explosivedude wrote:

okay im about to upload it right now

Ah - I made a few changes and fixed it up a little. Here's the fixed project:
http://scratch.mit.edu/projects/coolfixit/1168054

Offline

 

Board footer