Camera movement problem

flameblue59

  • Posts: 113
Hi, I've got a problem with camera movement, I'm using drag and drop behavior and set Move Camera on update event to follow X actor. First check in the flash version here.

http://www.fastswf.com/_qsOVQ4

When the symbol is dragged, the camera is going so fast. How can it be on slow movement. Thanks

LIBERADO

  • *
  • Posts: 2720
For a gradual and smooth movement, you can use this code:

« Last Edit: January 06, 2015, 12:23:41 am by LIBERADO »
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

flameblue59

  • Posts: 113
Works great, thanks :)
anyway, how to stop camera movement when the actor going up / down because when I drag the actor to the up / down. The camera X still move.

LIBERADO

  • *
  • Posts: 2720
In that kind of game the maze scroll is usually constant, like the one produced by this code:

« Last Edit: January 06, 2015, 12:22:25 am by LIBERADO »
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

flameblue59

  • Posts: 113
It almost work. Actually, the x camera should follow x actor, so the actor will stay on the middle of the screen, only the camera which is moving. then y actor can follow the cursor so it can move vertically. But the speed of camera movement must be limited cause when I dragged it too much left or right the speed is going so fast. So i need a constant speed.

LIBERADO

  • *
  • Posts: 2720
You can't force the mouse pointer to stay on the middle of the screen while you are moving the physical mouse.

« Last Edit: January 06, 2015, 01:57:56 am by LIBERADO »
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

flameblue59

  • Posts: 113
I mean, I'm not forcing the mouse cursor to stay at the center of the screen. So the actor only follow y of mouse. Then the scrolling will be set from the xmouse of the xactor. For example

x of actor =  360 ( x-center of screen )
x of cursor =  500

so the power will be set base on the cursor distance with actor.

so, it will be 500 -360 /100 = 1.4 force

after that, the force will move the X of camera and the other example

x of actor = 360 ( x-center of screen )
x of cursor = 700

the result 700-360/100 = 3.4 force.

I wish it could explain what I wanted for. I've tried this, but always doesn't work. Thanks