Aikocho Posted March 13, 2009 Report Share Posted March 13, 2009 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 More sharing options...
Felik Posted March 13, 2009 Report Share Posted March 13, 2009 It has been already discussed one billion of times Most likely targeting mechanism is working wrong. Show your homing attack code. Link to comment Share on other sites More sharing options...
Aikocho Posted March 13, 2009 Author Report Share Posted March 13, 2009 I used, Your homing tutorial. Link to comment Share on other sites More sharing options...
LarkSS Posted March 14, 2009 Report Share Posted March 14, 2009 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 More sharing options...
Aikocho Posted March 14, 2009 Author Report Share Posted March 14, 2009 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 More sharing options...
LarkSS Posted March 14, 2009 Report Share Posted March 14, 2009 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 More sharing options...
Aikocho Posted March 14, 2009 Author Report Share Posted March 14, 2009 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 More sharing options...
LarkSS Posted March 16, 2009 Report Share Posted March 16, 2009 I helped MSKaosu with this already, but decided that it may be a good idea to post the example I gave him so that future people will hopefully check here first if they have concerns. HomingMovement.7z Link to comment Share on other sites More sharing options...
luksamuk Posted March 17, 2009 Report Share Posted March 17, 2009 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. Link to comment Share on other sites More sharing options...
Damizean Posted March 18, 2009 Report Share Posted March 18, 2009 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 More sharing options...
luksamuk Posted March 18, 2009 Report Share Posted March 18, 2009 Yeah, don't let the lack of consistency between movement systems stop you from using half-assed methods. Well, when I said that, I said based on my own experiences. It works, but not the best way. At least for me. Link to comment Share on other sites More sharing options...
LarkSS Posted March 18, 2009 Report Share Posted March 18, 2009 @LH: My bad. HomingMovement.zip Link to comment Share on other sites More sharing options...
Turbohog Posted March 21, 2009 Report Share Posted March 21, 2009 Still broken Link to comment Share on other sites More sharing options...
DragonSky00 Posted March 24, 2009 Report Share Posted March 24, 2009 Well I tried to do the Homming, but just giving a problem, it does not work the qualifiers, the homming only works on monitors, but in badniks outside. is a problem in MMf2 or I programmed wrong. Oh and the link is broken Link to comment Share on other sites More sharing options...
Epon Posted April 4, 2009 Report Share Posted April 4, 2009 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 More sharing options...
Recommended Posts