Sign in to follow this  
kvinther

Graphics: Dragging a 2D 'object' across a static background.

Recommended Posts

Hi, I have a simple desktop based game with 2D graphics. I have some square playing pieces, and an image as background. One actions of the game is to pick up a piece, drag it somewhere, and put it down again. Now I would like to show the piece while it is being dragged, however I would like to avoid redrawing the entire "scene" for every little bit the mouse moves. I could imagine it being similar to making for instance, a drawing program - where you draw objects while they are moved. Does anyone have any experience with doing this? I am using simple .NET event-based developing. Cheers, Kristian

Share this post


Link to post
Share on other sites
Well an old fashioned technique of animation was to save a piece of the background (underneath where the object is to be drawn), then draw the image, then replace the background before moving the object. As long as you are double buffering and deal with other dynamic objects carefully this will work fine. But.. you should be able to redraw the entire background with out any problems (this is how most games work, the entire scene is redrawn every frame), if not then you are using the wrong techniques, althrough I can't remember offhand if .NET has any bit-blit type operations.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this