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

Ball mouvement [MMF]


Recommended Posts

Yeah, you can use trigonometry to do it. Just need the angle and this:

conditions for start movement:

object.set flag 0 on.

if object.flag 0 is on

set object.x (object.x + speed*sin(angle))

set object.y (object.y + speed*cos(angle))

Well, I can assume you are new into this, so i will tell you an easier way to do it.

Your character ha a movement, right? then, when you enable the homming attack, create an invisible point with ball movement.

When the number of those points is greated than 0, disable the sonic movement and do this:

set sonic position at 0,0 from point.

Just remember to destroy the object after homming is done and set the right speed values.

You can also make it a big circle instead a point, with the size of the "detection" area and the hotspot in the centre.

When you make homming, create a circle object. If that object doesnt overlap an enemy, destroy it and give sonic the speed desired (to make him move forward). If the sensor is overlapping an enemy, disable the sonic movement and set a flag on.

If that flag is on, set sonic position at 0,0 of the circle, start the circle movement and make circle to look at the enemy.

Be sure to check that if no enemy is over the sensor, destroy the circle and give sonic a certain speed.

That is less "clean" but it will be easier for unexperienced programmers.

If the circle object

Link to comment
Share on other sites

Yes this technic works good but when I lanch the homing attack it's work and when the invisible object collision on the ennemis, the position of sonic set as when I jump (lol i'm very sorry for my english ^^)

exemple :

Jump : (position X(sonic) is : 5)

(position Y(sonic) is : 9)

and when the homing attack is finish the position of sonic set :

(position X(sonic) is : 5)

(position Y(sonic) is : 9)

Normaly the position of Sonic remains the lasted position XandY of the ennemi

So I cant created object with ball mouvement

I'm obligate make the mouvement myself

Link to comment
Share on other sites

You mean that when you finish the homming, sonic returns to the original position? This is caused because of the inner variables. There is a variable that stores the X position and another that stores the Y position (they are counters or alterable values of a V shaped object). Be sure to change those values when doing the homming attack to the current position of sonic.

If homming is enabled:

set XX to sonic.x

ser YY to sonic.y

  • Like 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

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