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

#1 2010-12-24 01:40:30

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

Better Y Vel Collision?

I've always had a problem with y velocity collision in platformers. Usually, if dropped from a great height, a sprite will fall through the ground. I realize that I can easily correct this by making a sprite always "float" up by 1 pixel if its touching the ground, but that makes the sprite look like it's vibrating up and down, and also feels a bit cheesy. I've seen a few platformers which use y velocity, and still get past this/these problem(s).

How can I get better y collision? Is there a way to do it 1s1s?


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

#2 2010-12-24 01:50:16

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Better Y Vel Collision?

Ah yes. That's always frustrating. To be honest, I'm not totally sure; I don't make platformers much. I suspect that it's use of a bigger sensor, and/or just a better algorithm for deciding movement when touching the ground.  hmm


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#3 2010-12-24 02:00:28

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Better Y Vel Collision?

Harakou wrote:

Ah yes. That's always frustrating. To be honest, I'm not totally sure; I don't make platformers much. I suspect that it's use of a bigger sensor, and/or just a better algorithm for deciding movement when touching the ground.  hmm

I feel like my mind knows the answer, but it's going so fast I can't read it- It's on the tip of my mind.  tongue

Last edited by Sunrise-Moon (2010-12-24 02:01:16)


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

#4 2010-12-24 10:35:55

Kileymeister
Scratcher
Registered: 2008-04-17
Posts: 1000+

Re: Better Y Vel Collision?

Hang on, I have the script segment somewhere in my pictures.

Here it is:
http://i56.tinypic.com/10crjo5.gif

Last edited by Kileymeister (2010-12-24 10:36:28)


I'm back, and showcasing two new* projects!  Click left or right on the image below to see!
http://img109.imageshack.us/img109/7905/part1l.pnghttp://img859.imageshack.us/img859/6417/part2bf.png

Offline

 

#5 2010-12-24 12:38:33

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Better Y Vel Collision?

Kileymeister wrote:

Hang on, I have the script segment somewhere in my pictures.

Here it is:
http://i56.tinypic.com/10crjo5.gif

Thank you! That'll work perfectly! The only problem is it doesn't really detect slopes at all. I can probably fix it with a slope sensor or something, though.


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

#6 2010-12-24 13:00:51

Kileymeister_test
Scratcher
Registered: 2010-01-31
Posts: 100+

Re: Better Y Vel Collision?

Sunrise-Moon wrote:

Kileymeister wrote:

Hang on, I have the script segment somewhere in my pictures.

Here it is:
http://i56.tinypic.com/10crjo5.gif

Thank you! That'll work perfectly! The only problem is it doesn't really detect slopes at all. I can probably fix it with a slope sensor or something, though.

I can add a bit that can do that.  Give me a second.

Edit:  Put this with that script.
http://i51.tinypic.com/34i06jq.gif

Last edited by Kileymeister_test (2010-12-24 13:03:31)


Kileymeister's test account.  I upload engines and demos and stuff for public use.
Currently Working on: Grapple Arms!

Offline

 

#7 2010-12-24 14:10:52

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Better Y Vel Collision?

This project shows the best way to do all collisions.

http://scratch.mit.edu/projects/archmage/101212
download it and look at the scripts


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#8 2010-12-24 15:31:04

AtomicBawm3
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Better Y Vel Collision?

Pretty much what I think everyone else is saying.  Set a max velocity for your sprite, create a modding system (when you can), or just have a sensor that finds a better position.


http://i50.tinypic.com/j0yw0p.jpg

Offline

 

Board footer