How to move actors in multiples of 2?
shmartybird
Member Posts: 17
Hey guys,
I'm trying to get my actors to move randomly on the X axis in multiples of 2.
At the moment, they're moving (Move to) along the X axis at random(1,10), which obviously includes 1 and 3,5,7,9. This causes a blur when the actor is at a coordinate with an odd number.
Anybody know how I can move the actor in multiples of 2?
Thanks
I'm trying to get my actors to move randomly on the X axis in multiples of 2.
At the moment, they're moving (Move to) along the X axis at random(1,10), which obviously includes 1 and 3,5,7,9. This causes a blur when the actor is at a coordinate with an odd number.
Anybody know how I can move the actor in multiples of 2?
Thanks
Best Answers
-
gyroscope I am here.Posts: 6,598
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Answers
Ah my images are clear when moving but still become blurry when the actor stops.
I thought that moving the actor to an even/odd number position would stop the blurryness. Does anyone else have issues with coordinates and image clarity?
Annoyingly GameSalad places actors on sub-pixel values when you drag them into a scene, so to avoid blurriness all the actors you place in your scene (which sometimes can be hundreds) need to have their positions corrected/rounded up/down once they're placed in the scene.
Would I use the floor function for this?
My code is:
--------------------
Every random(1,5) seconds
Move to: Position random(1,10) Relative to scene
Speed random(20,50)
Timer: After random(1,5) seconds
For random(2,8) seconds
Change attribute self.XtargetPos to self.Position.X
Constrain attribute self.Position.X to self.XtargetPos
-------------------
It's hard to because I have no idea what their X coordinates will be each time they stop moving. So they might be stopping at a random sub-pixel coordinate every time.
Sorry to keep going on
It's not the actor that's the problem. It's where the camera happens to be in relation to the actors/background!!
My camera is moving along the X axis as the main character moves, but the main character is never blurry.
So basically the screen is moving at sub-pixel values.
Wow. You figure one thing out and a whole other set of problems arise!
Thanks guys...