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

#1 2013-02-07 16:59:53

Fyrox
New Scratcher
Registered: 2013-01-21
Posts: 17

Making a platformer

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

 

#2 2013-02-07 17:15:25

henley
Scratcher
Registered: 2008-06-21
Posts: 1000+

Re: Making a platformer

I would love to help you.

But you couldn't be more vague. What exactly "isn't working"? And what scripts did you use?


"I've worked so hard for you and you give me nothing in return. Do you need help... Or do I?"

Offline

 

#3 2013-02-07 17:32:30

Fyrox
New Scratcher
Registered: 2013-01-21
Posts: 17

Re: Making a platformer

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

 

#4 2013-02-07 20:52:26

estile
Scratcher
Registered: 2013-01-26
Posts: 100+

Re: Making a platformer

does this fix things http://scratch.mit.edu/projects/estile/3089324 sorry i cant add links. by the way, that is a more complicated than usual way to make platformers.


http://i45.tinypic.com/s4nvxl.png

Offline

 

#5 2013-02-08 09:00:28

MaanGames
New Scratcher
Registered: 2013-01-18
Posts: 6

Re: Making a platformer

Hi,
i made a platformer engine, you can use it for your project
or maybe the scripts help you  smile
link here:
http://scratch.mit.edu/projects/MaanGames/3089988

Offline

 

#6 2013-02-08 18:16:10

lalala3
Scratcher
Registered: 2008-10-03
Posts: 100+

Re: Making a platformer

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.


http://img515.imageshack.us/img515/9374/signature2nt.png

Offline

 

#7 2013-02-08 22:08:32

Fyrox
New Scratcher
Registered: 2013-01-21
Posts: 17

Re: Making a platformer

@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

 

#8 2013-02-08 22:14:18

lalala3
Scratcher
Registered: 2008-10-03
Posts: 100+

Re: Making a platformer

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.


http://img515.imageshack.us/img515/9374/signature2nt.png

Offline

 

#9 2013-02-09 10:06:34

Fyrox
New Scratcher
Registered: 2013-01-21
Posts: 17

Re: Making a platformer

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

 

#10 2013-02-09 11:38:16

Sqervay
New Scratcher
Registered: 2012-10-28
Posts: 52

Re: Making a platformer

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  wink

Offline

 

#11 2013-02-09 11:58:24

Fyrox
New Scratcher
Registered: 2013-01-21
Posts: 17

Re: Making a platformer

To be honest I didn't understand anything lol

Offline

 

#12 2013-02-09 12:16:18

lalala3
Scratcher
Registered: 2008-10-03
Posts: 100+

Re: Making a platformer

Your x velocity needs to be changed so that walls will stop the sprite, as opposed to simply preventing it from accelerating.


http://img515.imageshack.us/img515/9374/signature2nt.png

Offline

 

#13 2013-02-09 12:56:18

Fyrox
New Scratcher
Registered: 2013-01-21
Posts: 17

Re: Making a platformer

I've been trying to modify the script so it changes the velocity when it touches a wall, but I can't get it working. How could I do what Sqervay explained?

Offline

 

#14 2013-02-09 15:23:56

estile
Scratcher
Registered: 2013-01-26
Posts: 100+

Re: Making a platformer

usually you use the motion blocks more, and useing the sensing scripts in the sprite controled by the player, using that many variables can make the scripts overly complicated.


http://i45.tinypic.com/s4nvxl.png

Offline

 

#15 2013-02-09 16:48:30

Sqervay
New Scratcher
Registered: 2012-10-28
Posts: 52

Re: Making a platformer

uff, i canÄt explain it good, i think it's a little bit too complicated... sry  sad

Offline

 

#16 2013-02-09 16:52:59

Sqervay
New Scratcher
Registered: 2012-10-28
Posts: 52

Re: Making a platformer

*can't

Offline

 

#17 2013-02-09 17:10:08

Fyrox
New Scratcher
Registered: 2013-01-21
Posts: 17

Re: Making a platformer

Maybe you could make a sample program just to show me?  big_smile

Offline

 

#18 2013-02-09 17:15:43

Sqervay
New Scratcher
Registered: 2012-10-28
Posts: 52

Re: Making a platformer

ok.....i could try...

Offline

 

#19 2013-02-09 17:42:25

Sqervay
New Scratcher
Registered: 2012-10-28
Posts: 52

Re: Making a platformer

I hope with the scripts you'll understand a bit more..
here's the link:
http://scratch.mit.edu/projects/Sqervay/3093325

Offline

 

#20 2013-02-10 11:56:06

ocean636
Scratcher
Registered: 2012-12-14
Posts: 8

Re: Making a platformer

I made a base called... oh wait, I haven't shared it yet.

Offline

 

#21 2013-02-10 12:16:27

ocean636
Scratcher
Registered: 2012-12-14
Posts: 8

Re: Making a platformer

I've shared it now and It's called Ocean636's PERFECT platformer base.

Offline

 

#22 2013-02-10 12:46:56

Fyrox
New Scratcher
Registered: 2013-01-21
Posts: 17

Re: Making a platformer

Thanks a ton but, could you explain me how it works? I don't quite get it

Offline

 

#23 2013-02-10 12:56:20

MaanGames
New Scratcher
Registered: 2013-01-18
Posts: 6

Re: Making a platformer

Me or Ocean?

Offline

 

#24 2013-02-10 12:57:33

Sqervay
New Scratcher
Registered: 2012-10-28
Posts: 52

Re: Making a platformer

*-* I meant ME or Ocean?  big_smile

Offline

 

#25 2013-02-10 13:00:43

Fyrox
New Scratcher
Registered: 2013-01-21
Posts: 17

Re: Making a platformer

Both LOL doesn't your script work similarly? By the way MaanGames and Sqervay, I found that if in your platformed you go next to the wall and keep W and A pressed you climb the wall, is that intended?

Offline

 

Board footer