scrolling problem

sterlingy

Active Member
Licensed User
Longtime User
In my app, I have a background that is the world map and also defines the world coordinate system.

In the example I have attached, there is a car object that has a fixed location (it shouldn't move) when I scroll around the world (vertically only) the car should stay locked relative to the background.

It's close, but there does seem to be some slippage, and by looking at all the variables, it does keep it's world coordinates.

For the life of me, I can't find the culprit. I thought it might have something to do with scaling, but I don't think that is the problem.

I've bastardized the code to make things less complicated, with fewer objects zipping around the screen, and it's forced into scrolling.

Just look at the car move on the grid below it, and you'll see the problem.

The problem is probably in the TICK sub routine in one of two classes, Leroy or Car.

You'll have to place the "streetmap.jpg" in the files folder. Sorry, I had to break it up because of size restrictions.

Any thoughts would be greatly appreciated.
 

Attachments

  • GameApp_02.zip
    253.9 KB · Views: 187
  • streetmap.zip
    165.1 KB · Views: 159

sterlingy

Active Member
Licensed User
Longtime User
Basill99,

You had said:

My phone here is pretty old (2.2) so animation is not smooth at all. But all Gameview samples have this effect on my phone, so hard to decide. Hope to get new phone later today or tomorrow

You mean static car on the left side ? looks like it slide up down a bit ?

-----------------------

Yes, the car on the left should move relative to the scrolling background, as if it is parked and you're flying overhead.

-Sterling
 
Upvote 0

sterlingy

Active Member
Licensed User
Longtime User
My guess is that the problem is related to the fact that the background SrcRect height is diffferent than the DestRect height. You are setting the car related to the background SrcRect instead of DestRect.

Erel,

You're a genius. I never even thought to look at where I created the background object.

If you lived near me, I'd buy you dinner.

Thank you, thank you, thank you!!!!

Cheers,

Sterling
 
Upvote 0
Top