Help with platformer collisions

This forum is currently in read-only mode.
From the Asset Store
Particles support animations, collisions, effects and etc.
  • I'm making a Super Mario World game, and one element I'm having trouble replicating is the floating ? blocks.

    For those who don't know what those are, they're, well, floating blocks with ? marks on them. They're solid, so Mario can stand on them and can't go through them, and when he jumps into them from the bottom they bounce up a little bit and then go back to their original position.

    I've tried a couple different ways of doing this, from assigning the block Platformer behavior and having it jump, to making it a ball and trying to get it to bounce, but none of it seems to be working properly. Any ideas?

    Here's the .cap if you want to play around with it:

    http://dl.dropbox.com/u/19702035/mariosonic3.cap

  • Instead of moving the block, how about you just animate the bounce? You can keep the collision mask in it's place then.

  • Instead of moving the block, how about you just animate the bounce? You can keep the collision mask in it's place then.

    Wow... No idea why I never thought of that before. I was about to run ahead and start animating that, but I see the complicated route's already been done for me -- thanks a lot, TecmanX, that works perfectly.

    One question though, Tecman... can you explain exactly what you're doing with the Set Y to .y - (100*TimeDelta) part? Some crazy stuff is happening when I try to do something else with ItemBox, and I think it might be because I don't know what that bit of code means.

  • Quick question, hopefully a simple one -- is there any way to make a character flashing/blinking WITHOUT making an animation with every other frame being blank? That isn't too hard to do, but... as you can imagine, it's a lot of work. I'd rather not do all of that if there's an easier way.

  • Quick question, hopefully a simple one -- is there any way to make a character flashing/blinking WITHOUT making an animation with every other frame being blank? That isn't too hard to do, but... as you can imagine, it's a lot of work. I'd rather not do all of that if there's an easier way.

    The way I would approach this is as follows:

    Have a group (let's call it "flashing") that's always enabled, and have it monitor a variable that will determine whether the character should flash or not (let's call it "flashOrNot").

    Also, use a variable that will keep track of the flash rate (let's call it "flashDuration").

    In the "flashing" group, have it subtract delta time from "flashDuration", and if it dips below zero, add your initial amount (let's say 0.5 for half a second) and then toggle the character's visibility.

    And that's it.

    The "flashing" group will take care of everything for you, and all you have to do is set "flashOrNot" to 0 for no flashing, or 1 for flashing.

    Krush.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The Timedelta System Expression ensures that the block will move at the same speed regardless the framerate, look here for more info http://sourceforge.net/apps/mediawiki/construct/index.php?title=TimeDelta

  • Just to add what TecmanX has said, you can see from my example above that I use time delta for the same reason; To make sure that no matter what the framerate, the flashing will happen at the speed you want it, allowing people to see it flash exactly as you want them to.

    Krush.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)