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

[Help] Programming Homing properties.


Aikocho

Recommended Posts

I'm sure everyone wants to go "Ugh" For the mentioning of the word, "homing." But I got reason to Know.

I'm trying to implement the Gold shield from Sonic 3D Blast for Genesis. Most of you think that, It was introduced as an attack for the new gen games. That is true, but at the same time, it's false.

The homing attack was really a shield attack in Sonic 3D blast. If an enemy was nearby, Sonic would home in on it. If there isn't an enemy around, He would shoot to the ground and stop. The actual monitor can only be found in hard to reach or secret areas in the game.

Anyway, I really need help on programing this one power-up. I tried to implement it myself in worlds, I even used some of the tutorials as base to really figure it out, but he would just shoot to the top left corner of the level. Please, May I have just a bit of help here. I know it has been answered before, but I just need to understand the events.

Link to comment
Share on other sites

When I was helping Azu implement homing attack, we both thought it wasn't working but it turned out that Sonic was trying to target an enemy that was off the screen. So like Felik said, you may want to check your method of enemy targeting to make sure that you're homing toward the correct, nearest enemy.

Link to comment
Share on other sites

When I was helping Azu implement homing attack, we both thought it wasn't working but it turned out that Sonic was trying to target an enemy that was off the screen. So like Felik said, you may want to check your method of enemy targeting to make sure that you're homing toward the correct, nearest enemy.

But that's just the point of my thread. I don't know any methods... I want to learn the right method.

Link to comment
Share on other sites

Pythagorean's theorem. aka Sqr( ( X2 - X1 ) pow 2 + ( Y2 - Y1 ) pow 2 ).

If you always set an alterable value of an enemy to that equation, with XY1 being the enemy and XY2 being Sonic, you can have each enemy keep track of its distance to Sonic. Then, you can run a loop individually checking each enemy and comparing its distance value to Sonic's internal "closest enemy" value. If it's a smaller value than that ( make sure to set the closest enemy value to a big number before the loop btw ), then overwrite the closest enemy value to that of the enemy and store its fixed value into Sonic.

This fixed value is now your target, and after the loop is finished, you should have the closest enemy's fixed value. By making a condition that compares this value to Sonic's stored value from the closest enemy, you can then perform a homing attack using the data from this specific enemy.

Edit: You can always feel free to contact me via instant messengers btw.

Link to comment
Share on other sites

Pythagorean's theorem. aka Sqr( ( X2 - X1 ) pow 2 + ( Y2 - Y1 ) pow 2 ).

If you always set an alterable value of an enemy to that equation, with XY1 being the enemy and XY2 being Sonic, you can have each enemy keep track of its distance to Sonic. Then, you can run a loop individually checking each enemy and comparing its distance value to Sonic's internal "closest enemy" value. If it's a smaller value than that ( make sure to set the closest enemy value to a big number before the loop btw ), then overwrite the closest enemy value to that of the enemy and store its fixed value into Sonic.

This fixed value is now your target, and after the loop is finished, you should have the closest enemy's fixed value. By making a condition that compares this value to Sonic's stored value from the closest enemy, you can then perform a homing attack using the data from this specific enemy.

Edit: You can always feel free to contact me via instant messengers btw.

I'm trying my damn best to comprehend this. I really am... If only I wasn't such an idiot to this theorem...

EDIT: Lark, I'll give you a PM tomorrow or at least the next time you show up. regarding this.

Link to comment
Share on other sites

Doesn't work as well as an bouncing ball-moved object looking toward group Enemies.

Pythagorean's Theorem is still not the bast way to do that. I can tell -.-

EDIT: Oh and Lark, the link is broken.

Yeah, don't let the lack of consistency between movement systems stop you from using half-assed methods.

Link to comment
Share on other sites

  • 2 weeks later...

Why is this so difficult...? Maybe I'm just not understanding the issues you're all facing.

Just have some kind of loop or something that checks all the badnik's distances from your character. Only store the currently checked badnik if its distance is smaller than the previous one's. When the loop is done, you have your badnik and distance away (and hopefully its X,Y).

Pick whatever method you want to home in accordingly.

There's a dozen different ways to really do this depending on how you want to implement it.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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