[BEHAVIOR] Sonic Physics

1 favourites
From the Asset Store
Hybrid Sonic Branding Kit is a business identity & motion graphics sound effects library.
  • PixelMonkey fancy trying a Mario behaviour? 😄 Nothing could be as tricky as sonic but would be fun to have cape Mario/floating Mario/mini and super Mario switchable movements

  • TheAmazingApple:

    I think I'm following a bit more clearly. Sounds like an existing issue that I've been trying to redo the angle system for regardless, so hopefully when I fix the issue I know of it'll fix yours by extension. The behaviour doesn't cope well yet with more complex surfaces and intersections between multiple angled sprites, since it currently all boils down to choosing a single segment to stick to, which doesn't always act as you'd expect it to. Working on this has given me a fair bit of insight as to how complicated this can get, even if not yet how to actually make it work, haha.


    Actually, I'm pretty sure the standard Platform behaviour could get you a close match to Mario physics via events. I'm not as familiar with the Mario games as I am with Sonic, so there could be some subtleties that'd need to be mimicked, but sounds to me like it'd be more waiting on someone to make a capx than a behaviour. I do recall briefly looking for a Mario equivalent to the Sonic Physics Guide a while back, though, but I didn't have any luck. Anyone know if something along those lines exists?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok.

    Anyways, the Sonic Engine thing is going somewhat great so far. I got to add the elemental shields from Sonic 3. I also added spikes into the game. When a playable demo is released, I will credit you for making the Sonic Physics addon.

    Well, it's time for me to listen to Never Gonna Give You Up by Rick Astley on loop for 24 hours while I stare at an image of Thomas The Tank Engine running over a teenager.

  • Im looking forward to trying this out thanks

  • You'll want basically just:

    Sonic: On collision with Bumper:

    -Set Vector X to 420 * cos(angle(Bumper.X, Bumper.Y, Sonic.X, Sonic.Y))

    -Set Vector Y to 420 * sin(angle(Bumper.X, Bumper.Y, Sonic.X, Sonic.Y))

    The info.sonicretro.org/Sonic_Physics_Guide Sonic Physics Guide, particularly the Springs and Things page, gives some more numbers and info, but you'll want to update most values from pixels per frame to pixels per second.

    ^ That said, though, I tried it out myself, and I've recreated TheAmazingApple's bug in the process. Unless you're holding down the jump button, it caps your speed to Min Jump Strength. So the above example events currently won't work unless the jump button is being held down.

    If you wanted a really hacky workaround, you could simulate jump button under certain conditions to stop the behaviour from limiting the jump, but I realize that's pretty terrible.

    This has been a big help for quite a few things on what I'm working with, thanks!

    Anybody in this thread experienced with making online games in Construct? My project's aiming to have online co-op with a lot derived from this Sonic Physics behavior. Seems like one of the tougher things could be camera focusing on individual players.

  • I discovered another minor problem. The double jump option doesn't work. You should fix that.

  • TheAmazingApple

    I believe that's on the todo list, but noted, thank you. Worth clarifying, though, that I've deliberately removed the double jump functionality for the sake of not filling the properties section with more than is necessary, since double jump functionality is fairly straightforward to implement. I see that I missed the actions/conditions related to that, though, and I assume that's what you're referring to?

  • The only action/condition related to the double jump is "set double jump" and "is double jump enabled", (the set double jump doesn't work. I haven't tried out the "is double jump enabled" event, though.)

    P.S you should also add a "On roll" animation trigger as I am trying to add the rolling sound effect when Sonic, well, rolls.

  • This is great, I'm using this for my project but I have a question, how can I detect collisions and simulate jumping?

  • patchester

    As far as I know, the behaviour shouldn't really change the way either of those things work in comparison to the Platform behaviour. The standard events for collisions and overlaps should still trigger under the same circumstances, and if you have a "is key down" condition followed by the "simulate control: jump" action, that should mimic the default controls.

  • Thanks of the reply. There's a bug I found with this behaviour. In my project I have tilemaps setup used as the ground, set with a behaviour of Solid, if the player tries to move across any of these tilemaps, everything disappears off the screen. I tried making a new project and found out that this only happens with the SonicPhysics and not with any other behaviour. Fix would be great. Also player get's stuck on pixels on the ground while moving?

  • patchester:

    Yep, tilemaps are still not working. It's one of the higher priorities at the moment, though. Would you be able to give me more details on that second issue?

  • While playing in game, the Player gets stuck on some pixels on slopes and such and Is only able to jump.

  • patchester

    What kind of slopes cause this issue? Does it happen anywhere in particular in the example?

  • Most slopes, mainly on the Concave you provided.

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