SCUMM games - Printable Version +- iDevGames Forums (http://www.idevgames.com/forums) +-- Forum: Development Zone (/forum-3.html) +--- Forum: Game Design (/forum-5.html) +--- Thread: SCUMM games (/thread-7703.html) SCUMM games - mySocksAreOnFire - Jun 16, 2002 11:41 AM What, overall, is the best way to do the sprite resizing in SCUMM-style games to create the illusion that a character is walking towards/away from the camera? SCUMM games - kainsin - Jun 17, 2002 11:06 AM First figure out where the 0 z-value lies in the scene. Then figure out how far away the "front" and "back" of the scenes are. You can estimate these by figuring out just how much larger or smaller the sprite should be. If, for instance, the sprite is 150% of the normal size when it is all the way in the front of the scene the the z-value for the near-plane should be 0.5. If the same sprite is about 75% of the normal size when it is all the way at the back of the scene then the z-value of the far-plane should be -0.25. Doing it this way you should keep track of the sprites based on the point at the center of their rectangles instead of the top-left or bottom-left point. Now, figure out where the sprite lies in the scene, in other words its z-value. Multiply the z-value by 100 and this will be the % of the size that needs to added to the total size. Say that a sprite is resting at z-value 0.2, well 0.2 x 100 = 20%, and since this is positive the sprite will be getting larger. If the size of the sprite is 100x100 pixels, then 20% of 100 ( on both sides ) is just 20, which will mean that the size of the sprite at this z-value is 120x120 pixels. Keeping in mind that you are tracking the center of the sprite, you would just divide the width and height by 2, then subtract those from the x and y positions of the center point to determine where the new top-left ( or bottom-left ) point should be. If you only held on to the top-left ( or bottom-left ) point then you can see that as you scaled the image it would only be growing in size from the opposite corner and would look a bit off. You would have to do more calculations that arn't really necessary in order to componsate for this behaviour. (* Remember folks, Math is fun! ^_^ *) Hope this helps, SCUMM games - mySocksAreOnFire - Jun 17, 2002 12:39 PM Thanks! I'll get to work on that...