YesNoOk
avatar

Mai Natsume's Gallia Sphyras (Helper based projectile that tracks) (Read 457 times)

Started by OHMSBY, October 04, 2018, 10:45:51 pm
Share this topic:
Mai Natsume's Gallia Sphyras (Helper based projectile that tracks)
#1  October 04, 2018, 10:45:51 pm
  • **
    • USA
Ok, so this is what I'm trying to recreate:


In Blazblue, after Mai throws her spear, pressing the drive button will have the spear immediately turn and move towards the opponent's current position at the time the button was pressed.

Right now, I have something that sort of works. But, "sort of" isn't going to cut it.

The way I currently have it set up is to have the spear go into a state makes it change direction upon having the button pressed.

This is the state in question:
Spoiler, click to toggle visibilty

Most of the time, despite the use of P2dist X/Y, the spear will go towards a completely different direction behind Mai.

The angle draw code that I used is supposed to have the spear face the direction it is moving in, but it sometimes seems a little off. It also brings up a debug error that says its trying to divide by zero.

I have the velsets based on the opponent's X and Y distance, however this causes the spear to either move too fast or too slow depending on when the button was pressed. I tried to fix this by having separate velset codes that trigger when the distance is at a certain threshold. It sort of works, but again, "sort of" isn't going to cut it. There has to be a better way to go about this.

Any sort of help with this would be much appreciated.
Last Edit: October 05, 2018, 06:42:56 am by OHMSBY
Re: Mai Natsume's Gallia Sphyras (Helper based projectile that tracks)
#2  October 04, 2018, 11:41:00 pm
  • **
    • USA
I remember talking to Ares about something like this months ago for something and he said he would use a trigonometry formula for homing.
Code:
x = (ABS(floor(fvar(30)) / fvar(32)) * ifelse(floor(fvar(30)) < 0, -1, 1)) * 13
y = (ABS(floor(fvar(31)) / fvar(32)) * ifelse(floor(fvar(31)) < 0, -1, 1)) * 13

ceil((atan(fvar(12) / fvar(13)) * 180) / pi) - (90 * ifelse(p2dist Y - ((-(enemynear,const(size.mid.pos.y)))) < 0, -1, 1))
ceil((atan(fvar(12)) * 180) / pi) - (90 * ifelse(p2dist Y - ((-(enemynear,const(size.mid.pos.y)))) < 0, -1, 1))

Truthfully I don't really know character coding so I don't know if this actually helps.
Re: Mai Natsume's Gallia Sphyras (Helper based projectile that tracks)
#3  October 05, 2018, 06:45:44 am
  • **
    • USA
This actually did give me an idea of what I'm supposed to do. After messing around with the code more, I eventually got it to work the way I want it to.

Thank you very much.