Hello, I'm trying to make a platformer game in Scratch, and found this link about sensors (http://scratch.mit.edu/forums/viewtopic.php?pid=1141838#p1141838). I've tried make a platformer adding gravity to the wall detection script, but I just can't make it work. Any ideas? Thanks in advance.
Offline
Okay you are right, I wasn't really descriptive. I tried to kind of combine a movement script I made a while ago (link ) with the sensor script I found in the forums and here is what I got.
The problem is that when I press the green flag, the sprite goes under the ground and can't go up, even if you move it with the mouse. I'm really sorry about not giving enough information at first, but I've been trying to fix it last 2 days and couldn't, so I was a bit upset with myself. Hope its enough now,
Offline
Fyrox wrote:
Okay you are right, I wasn't really descriptive. I tried to kind of combine a movement script I made a while ago (link ) with the sensor script I found in the forums and here is what I got.
The problem is that when I press the green flag, the sprite goes under the ground and can't go up, even if you move it with the mouse. I'm really sorry about not giving enough information at first, but I've been trying to fix it last 2 days and couldn't, so I was a bit upset with myself. Hope its enough now,
Simple. Your y velocity needs to be reset before the game starts. It's currently below -1000, I don't remember by how much.
Offline
@estile yeah, that fixed the problem I had, but still the sprite glitches with platforms. What is the usual way to make platformers?
@MaanGames thank you very much, but your code seems really complicated to me, and have functionalities I don't really want at the moment, like bouncing.
@lalala3 okay I fixed that, but as I said to estile, the sprite glitches with platforms, it gets stucks on them sometimes.
Offline
Fyrox wrote:
@estile yeah, that fixed the problem I had, but still the sprite glitches with platforms. What is the usual way to make platformers?
@MaanGames thank you very much, but your code seems really complicated to me, and have functionalities I don't really want at the moment, like bouncing.
@lalala3 okay I fixed that, but as I said to estile, the sprite glitches with platforms, it gets stucks on them sometimes.
Try making the sensors thicker.
Offline
Now that I made the sensors thicker the sprite doesn't glitch, but it only detects ground collision, I mean, walls and platforms don't stop the sprite from moving. I'm still wondering what was the usual way to make platformers that estile mentioned.
Offline
After it detects ground it changes y a bit, then it doesn't touches ground. After that check collision again and if it touches the wall again it has to be a wall on the left or right, then it changes xvel a bit and it moves a step away from the wall. Like this you can make collision without a sensor costume...
I hope it isn't too confusing and I could help
Offline