Moving the screen with the player....

andrewo
11-02-2001, 05:59 AM
In my program I've got a Point on the screen that can move at any 360 degree angle and has its physics like space....

But my problem is it moves around the screen ..I want the screen to actually follow the point....but still move around with the space like physics that ive given the point(a ship)

like diablo..how the screen follows the player around with the player in the middle...

Squirm
11-02-2001, 08:12 AM
What you need to do, is once youve calculated how far the player should move in one direction, you use that amount to move the game world in the OTHER direction, thus keeping the player in the centre. So you move the world instead of the player.

Lets say you have a redraw sub, which draws all of your characters. When you move the player, you would change the offset value for this sub, so that all images are drawn to the new offset, thsu moving the game world and giving the appearance of the player moving within the world.

Teric
11-02-2001, 08:27 AM
Here's a demo that I got from another website. It shows a good example of what you're looking for.

andrewo
11-02-2001, 07:41 PM
thanx squirm thats a good idea


and that attachment teric gave me an idea...

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum