[SOLVED] Help with zoom and movement


#1

Why my code doesn’t work?
When I press right key my object goes to the right and stops in the middle of the scene.
If I keep pressing a lot of times the right key it continues going to the right but the camera
doesn’t follow it.

I have this project with same code and have no problem.


#2

look at the numbers of your screenshot.
you´ll find a number that’s only half of the number of the other screenshot.

didnt you say you want to pay more attention to your events? :wink:


#3

Because my second screenshot the screen is wider. It has 1600 px.


#4

The cam will follow your object till it’s bounds reach 800 in x
Since your zoom is x2 the cam boarders should be 400 px wide
This means the cam will follow your object till 600px in x (800-400/2 =600)
Place an object at 799x and you see that the cam stops at that object. (1px visible)


#5

haha! I know what happened. Actually it’s working fine. I was confuse because I had nothing else on screen but my moving object. It gives me the sensation my object get stuck in the middle of the scene. You are correct as always! Thanks friend.