Is 'move to' dynamic? I am having problems
charlieaf92
Member Posts: 84
To eliminate new actor spawning during gameplay, I have developed an actor 'recycling' system that makes them invisible and moves them off the screen when they are killed. Then, they re-activate and start over.
The problem that I am having is that once I move them off the screen they continue to move in the same direction that they did when they originally spawnd - regardless of what direction they should be moving.
I have 'Move To' setup to global X and Y attributes that are constrained to their target's X and Y.
When the enemy is killed, I change the enemy's X and Y attributes to move them off screen.
Shouldn't 'move to' by dynamic based on the actors relationship to the coordinates? I have tried setting the relative to scene and actor with the same results for each.
Any advice is appreciated.
Thanks!
Charlie
The problem that I am having is that once I move them off the screen they continue to move in the same direction that they did when they originally spawnd - regardless of what direction they should be moving.
I have 'Move To' setup to global X and Y attributes that are constrained to their target's X and Y.
When the enemy is killed, I change the enemy's X and Y attributes to move them off screen.
Shouldn't 'move to' by dynamic based on the actors relationship to the coordinates? I have tried setting the relative to scene and actor with the same results for each.
Any advice is appreciated.
Thanks!
Charlie
Comments
`when alive is true
move to target x and target y
otherwise
change attribute self.pos.x to ??
change attribute self.pos.y to ??`
As for your method, do you have 'run to completion enabled'? It could be that but I'm not sure.
Sorry if this was more of a nuisance than an answer, hope it helped though!
when self.positionX is < 100
change attribute self.positionX to 400
change attribute self.posiitonY yo 160
When I tested this it changed to 400,160 and immediately continued chasing the target.
RH - you might be right about over complicating it. I have a group created for when the enemy dies that includes all of the necessary death pieces (increase score, death effect, etc) - and it also has the 'reset' pieces. Right now the moveto is outside of all rules, but I have also tried moving it into the reset piece as well.
SC - when you teleported your actor back to a new position - was it different than its original start position in relation to your target? To me it sounds like your test shows it is dynamic and should be working. Maybe I just need to retry it a few more times - it was kind of late, maybe I overlooked something obvious.
By the way - this particular target is stationary, I am not sure if this makes any difference as I am still using constrain attribute to track it globally.
Thanks again
charlie
If you use accelerate to it may work better, but you may want to control the speed. The easiest way to do this is in the actor attributes panel under motion. Just set the max speed to what you had in the move to speed box. Then set you accelerate to speed really high (2000).
Give that a try - I think you may like the results.
I tried hard coding the coordinates that the enemies seek and it still did not work correctly. Then, I tried setting them to seek the player's global X and Y coordinates and it works perfect. I think the reason is that they are changing.
My guess is (and someone please help me out if you know better) that GS is taking the the X and Y of the actor and the target and calculating the slope. Then, making adjustments to X and Y to draw a line between the two.
BUT it is not updating its equation unless the X and Y of the target changes.
This is definitely a situation where some source code could help. Programming without code is great, but sometimes you need to understand the logic behind what is going on under the hood.
Any thoughts?
Thanks
Charlie
It should definitely be noted in the documentation that the MOVE TO behavior only updates when the target X and Y coordinates change. Changing the coordinates of the actor WILL NOT updates its path.
charlie