MysticTrunks
Member
I'm working on both a C++/SDL and RPG Maker Xp abs system and while most of my code transfered over nicely my code for pointing a direction did not.
Basically for a abs when you hit your enemy it will point the direction where the Hero's X/Y is located. So for an example I'll basically just show you how it'd be done in Game Maker(won't give out my C++ code yet)
while(enemy_hit=true) {
speed=2;
direction=point_direction(herox,heroy,x,y)
}
should be simple enough.
Edit: did some playing around in C# this is what I'm thinking but don't know RPG Makers api well enough to be certain.
x = x + cos(hero_x) * direction
y = y + sin(hero_y) * direction
dt = ((x2 - x)^2 + (y2 - y)^2) ^ 0.5
new position
x = x + (x2 - x) * (direction / dt)
y = y + (y2 - y) * (direction / dt)
Basically for a abs when you hit your enemy it will point the direction where the Hero's X/Y is located. So for an example I'll basically just show you how it'd be done in Game Maker(won't give out my C++ code yet)
while(enemy_hit=true) {
speed=2;
direction=point_direction(herox,heroy,x,y)
}
should be simple enough.
Edit: did some playing around in C# this is what I'm thinking but don't know RPG Makers api well enough to be certain.
x = x + cos(hero_x) * direction
y = y + sin(hero_y) * direction
dt = ((x2 - x)^2 + (y2 - y)^2) ^ 0.5
new position
x = x + (x2 - x) * (direction / dt)
y = y + (y2 - y) * (direction / dt)