I've been making a Mario remake that uses a custom pseudo-physics engine for Mario (x-velocity and y-velocity) for his movements. It's based off the generic Gravity Ball -surprise- format: when the up arrow key is pressed, Mario's y-velocity increases by 5 and immediately starts decreasing so that after about a second or, it's down to zero, and then in the negatives.
Once Mario hits a Block object, I have a Forever if(Mario-SurfaceOnTop=1 And y velocity<0) statement that sets the y velocity to 0. This should work, as Mario does stop his vertical falling: after a millisecond. This causes him to go anywhere to one pixel to completely through the block, depending on how fast his initial velocity was. Is there a workaround/fix for this?
Offline
This is usually because the falling sprite has a y velocity that is too great, resulting in the sprite already being halfway through the floor as soon as it touches. The only real way is to make it fall slower, or add an invisible sprite that does the sensing.
Offline
Harakou wrote:
This is usually because the falling sprite has a y velocity that is too great, resulting in the sprite already being halfway through the floor as soon as it touches. The only real way is to make it fall slower, or add an invisible sprite that does the sensing.
The speed cap it is. Pity, I was hoping Scratch would have a built-in fix for these errors. Thanks!
Offline
DiogenesTheCynic wrote:
Harakou wrote:
This is usually because the falling sprite has a y velocity that is too great, resulting in the sprite already being halfway through the floor as soon as it touches. The only real way is to make it fall slower, or add an invisible sprite that does the sensing.
The speed cap it is. Pity, I was hoping Scratch would have a built-in fix for these errors. Thanks!
No problem. There's actually a minuscule delay built into the repeat blocks so that new programmers don;t get confused when their sprite races off screen. It actually makes game making much easier, but it unfortunately results in slowed mathematical operations and less fine control over movement speeds.
Offline