Help with ProtonSDK's Surface and SurfaceAnim components #32
-
Hey, I am working on a 2D platformer game inspired by Growtopia, using Proton SDK. I'm reaching out to ask for a bit of help with rendering the player character. In the initial stages of development, my focus is on rendering the basic player character without diving into animations just yet. However, I've encountered some challenges in understanding how to use the "Surface" and "SurfaceAnim" components. Unfortunately, the available documentation is limited, making this task more complex than anticipated. I've already grasped the basics of Proton SDK to some extent, but I'm struggling to properly draw the player along with its animations. I kindly request any additional information, guidance, code snippets, or best practices you can offer to assist me in rendering the player character. Your insights at this point would be a valuable addition to my project, helping me establish a strong foundation before I move on to more advanced animations. Thank you for your time and consideration. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Sure, Hmm, you're right, there is really no documentation on this. A surface loads a graphics, and allows you to do 2d blits to the screen easily. SurfaceAnim subclasses Surface and adds a few extra things for animations and blitting, so you pretty much want to always use that. The RTBareBones example shows a Surface being loaded and blitted - a lot of the code is commented out, but it shows valid examples of different ways to "blit" it to the screen. If you look through the SurfaceAnim header, you can see a lot of different Blit functions, some let you tint the image with colors, or rotate it around a specific point.
You can also say "this giant bmp is actually a grid of frames, so treat it like an animation" - just call SetupAnim or SetupAnimBySize after loading it. Then by using BlitAnim, BlitScaledAnim, or BlitRotatedAnim you can also specify a certain frame to draw. You might want to check out the Loony Ladders game example, I think it uses SurfaceAnim for everything. |
Beta Was this translation helpful? Give feedback.
Sure,
Hmm, you're right, there is really no documentation on this. A surface loads a graphics, and allows you to do 2d blits to the screen easily.
SurfaceAnim subclasses Surface and adds a few extra things for animations and blitting, so you pretty much want to always use that.
The RTBareBones example shows a Surface being loaded and blitted - a lot of the code is commented out, but it shows valid examples of different ways to "blit" it to the screen.
If you look through the SurfaceAnim header, you can see a lot of different Blit functions, some let you tint the image with colors, or rotate it around a specific point.