2d Sprite Animations without using XNA or other third-party libraries

后端 未结 3 1736
挽巷
挽巷 2021-02-06 02:27

I want to create a simple game, similar to what can be created with RPG Maker. What I am primarily looking for at the moment is a tutorial which can guide me on how to accomplis

3条回答
  •  醉梦人生
    2021-02-06 03:06

    On quick search I found this example. I'm not very experienced in c# graphics, but here are few points I have learned working with non-graphic oriented languages:

    • Declare where/what you want to draw
    • Create a loop to run until abort/event to end the loop (like object colliding with something)
    • In the loop: wait, clear the old drawing area, recalculate new position, draw in new position
    • If needed you can change the image to draw too, but then you need separate images for each "frame" you want to have
    • multithreading is a good idea, so you can separate running the graphics from other game logic
    • try keeping the time from clearing the drawing area and re-drawing as short as possible to prevent flickering
    • Keep track of the size of objects you draw, makes it easier to check for collision (like center of the sprite + radius, then you can easily calculate a circle area around it to check if two sprites are too close to each other)

提交回复
热议问题