I have a stupid problem. I want to move my actor only to middle of the screen. But the actor all time invader the right screen!! I tried with camera mode. Unfortunately i can´t move the rectangle to left position.
I think I understand. You want the purple guy to always be on the left side of the screen. Here's what I do.
Step 1) Create a game attribute called game.PurpleGuyX
Step2) In the purple guy add a constrain behavior. Constrain game.PurpleGuyX to self.positionX
Step3) Drag a blank unmovable and invisible actor into the scene, double click on it in the scene, and unlock it (click on the big padlock). Then add a rule -
when game.PurpleGuyX is greater than 100 -----constrain currentscene.camera.origin.x to game.PurpleGuy-100
this will cause the purple guy to always be 100 pixels from the left edge of the camera. The rule that you wrap the camera constrain in makes sure that the camera does not go less than 0 which will show black on the left of the screen.
Just be sure to NOT use a control camera behavior anywhere.
scitunes said: I think I understand. You want the purple guy to always be on the left side of the screen. Here's what I do.
Step 1) Create a game attribute called game.PurpleGuyX
Step2) In the purple guy add a constrain behavior. Constrain game.PurpleGuyX to self.positionX
Step3) Drag a blank unmovable and invisible actor into the scene, double click on it in the scene, and unlock it (click on the big padlock). Then add a rule -
when game.PurpleGuyX is greater than 100 -----constrain currentscene.camera.origin.x to game.PurpleGuy-100
this will cause the purple guy to always be 100 pixels from the left edge of the camera. The rule that you wrap the camera constrain in makes sure that the camera does not go less than 0 which will show black on the left of the screen.
Just be sure to NOT use a control camera behavior anywhere.
RESOLVED!!
Thanks you very very very much!!! :DDD
I promise to make a videotutorial. Thanks Scitunes. I so happy
Comments
My actor want that only shoot water in one direction (right) If he cross the right screen. The player never will wacth the next fire.
No entiendo que es lo que intentas hacer.
Explícame un poco más.
Step 1) Create a game attribute called game.PurpleGuyX
Step2) In the purple guy add a constrain behavior. Constrain game.PurpleGuyX to self.positionX
Step3) Drag a blank unmovable and invisible actor into the scene, double click on it in the scene, and unlock it (click on the big padlock). Then add a rule -
when game.PurpleGuyX is greater than 100
-----constrain currentscene.camera.origin.x to game.PurpleGuy-100
this will cause the purple guy to always be 100 pixels from the left edge of the camera. The rule that you wrap the camera constrain in makes sure that the camera does not go less than 0 which will show black on the left of the screen.
Just be sure to NOT use a control camera behavior anywhere.
Thanks you very very very much!!!
:DDD
I promise to make a videotutorial.
Thanks Scitunes. I so happy
kipper