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
that didnt work he fell right through the floor again..
Offline
okay im about to upload it right now
Offline
Ah, here's the problem.
This is a script you have:
<when I receive[ next level
<go to x -214 )y
-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 -214 )y
-30 )>
<forever>
<if><< <not> ><touching[ sprite 4>
<change y by( -7)>
<end>
<end>
Offline
Greentabby55 wrote:
Ah, here's the problem.
This is a script you have:
<when I receive[ next level
<go to x-214 )y
-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-214 )y
-30 )>
<forever>
<if><< <not> ><touching[ sprite 4>
<change y by( -7)>
<end>
<end>
uhm it didn't fix it....
Offline
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
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
Offline
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