auto chase player when enemy spawn?

74 views
Skip to first unread message

Ghen

unread,
Aug 9, 2015, 1:21:04 PM8/9/15
to HaxeFlixel
sorry guys, another question, theres 2 questions actually

1. is it possible to chase player when that enemy class get spawned?
in unity you can easily take the player object, and get the position and chase based on enemy position in update function, is it possible here?
i read on old hexaflixel forum about using : FlxVelocity.moveTowardsObject(this, Register.Player, speed);
but i got no idea how to use it properly, what Register.Player supposed to meant, because it's invalid in FlashDevelop

2. is there any tutorial/source for randomly spawn enemy outside of canvas?, i already google it of course, but some of the tutorial link not exist anymore

thank you in advance

SruloArt

unread,
Aug 9, 2015, 2:17:00 PM8/9/15
to haxef...@googlegroups.com
1. Check out this demo: http://haxeflixel.com/demos/TurnBasedRPG/ and this line in the Enemy class from its source: https://github.com/HaxeFlixel/flixel-demos/blob/master/Tutorials/TurnBasedRPG/source/Enemy.hx#L95.
2. Why does it have to be "outside"? all you have to do it to make your game a bit bigger (bigger than your game's screen's size) and spawn the enemies there.

Solid_Metal

unread,
Aug 9, 2015, 2:28:57 PM8/9/15
to HaxeFlixel


On Monday, August 10, 2015 at 1:17:00 AM UTC+7, SruloArt wrote:
1. Check out this demo: http://haxeflixel.com/demos/TurnBasedRPG/ and this line in the Enemy class from its source: https://github.com/HaxeFlixel/flixel-demos/blob/master/Tutorials/TurnBasedRPG/source/Enemy.hx#L95.
2. Why does it have to be "outside"? all you have to do it to make your game a bit bigger (bigger than your game's screen's size) and spawn the enemies there.



Awesome!, thanks for the answer here, and on the other thread, i'll definitely will try it again soon, and will mark the thread as compete :D 
Reply all
Reply to author
Forward
0 new messages