Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

Sonic And The Secret Rings 2D Prob


woflcub

Recommended Posts

I'm sorry young waffle, but I'm not exactly sure what you are wanting. Could you please describe the action in terms of something like how I'd describe the spin dash?

IE:

The player's character is in the crouching animation

The player presses the action button for jump and goes into the spindash start pose

In the spindash start pose, the player can press the action button for jump to add power to the spindash. Power gradually decreases at all times.

The player can then release the down button in order to go instantly into the roll animation with speed based on the power of the spindash.

Link to comment
Share on other sites

Ok, so basically you just want the following:

Push a button while moving or in whatever state.

Player character rolls into a ball.

After something like a quarter of a second, player character unrolls going at such and such speed until the button is pressed again.

Or am I mistaken?

Anyway, as for how you'd go about this, this is largely going to depend on your engine. Are you using a specific engine that any of us would be familiar with or is it a home-grown engine of your own design? Also, what program are you using if it's something like MMF/GM or did you program it from the ground up?

Link to comment
Share on other sites

Well, since you made it yourself and since you are, I'm guessing, a beginner... that means things are probably going to be messy... since you aren't likely using any kind of action control type thing such as a state machine. Since that's the case, I guess just for the purpose of learning, you could have a variable that you turn on (set to 1) when you push the button if it's off (set to 0) and that variable could represent whether or not the boost is activated. Once it's activated, if the player could start the boost animation which would basically just be a short roll for the first 6 frames or so and then turn into a regular fast running animation for the next however many frames and loops back to the beginning of the running phase. If it's on and the frames are beyond the first however many that are used for the roll portion of the animation, set the speed higher than it is otherwise. If he pushes the button again, put him back in the regular fast running animation and turn the variable back to off.

You could do it cleaner though if you had an engine that allowed you to have a so called 'boost state' which uniquely puts the character in boost mode rather than having it be it's own thing.

Link to comment
Share on other sites

Lol well that makes since xD. Preety much i put a parent on the enemies so i would make him go to the closest enemy with the parent on, but im not close to that lol. Do you know a homing attack code i could work on or something so i can see how it works and analyze it to make my own?

Link to comment
Share on other sites

Well you know, depending on your engine the implementation of your homing attack can be pretty varied. Usually I'd have a homing attack state where I'd have the target point defined and the starting point being the player's position at the beginning of it and then I'd use some cheeky formula to make an arc, probably starting with a slope of zero. From there I'd simply follow the arc with a specific arc length delta each frame. Or maybe I'd approximate it by just going so far along the x if calculating arc length ended up being an issue.

But I have to stress that everyone does it differently and there is no real 'wrong' way of doing it... unless you know, it doesn't hit the target. And even that's right if you consider the source material. ZING!

Link to comment
Share on other sites

I guess that's kind of following the whole action/state concept, but at the same time by having them in separate variables makes it very error prone.

A better way to handle your actions is to use an action state value which would represent something based on what it's set to. Like for instance:

0 - normal movement

1 - jump

2 - homing attack

3 - speed break

And then your events for controlling motion can use the variable of the action state in consideration.

This way your actions are less error prone in general because only one state can be active at a time no matter what kind of mistake you make programming.

  • Like 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...