zacharycarter / zengine

2D | 3D Game development library
157 stars 13 forks source link

Starting on the sprite implementation #32

Open define-private-public opened 6 years ago

define-private-public commented 6 years ago

At this moment we are able to read and parse in a very minimal .zsprite file. So far we can do things like define frames, sequences, add looping modifiers, etc.

Righut now there is a Sprite object, and a ZSprite object (which is a child of Sprite). They are mainly ment to be dumb data containters that only are for managing the state of a sprite object (e.g. timing, which frame to show, etc). In the futur we plane to have sprites that are defined by theSplineformat, so that's why I made the common Sprite` base object. In case a game dev also wants to make their own custom sprite they can two sub-object it too.

The rendering logic (and OpenGL state) is going to be put inside the SpriteBatch object. Right now it's only going to support ZSprites, but in the future will support SplineSprites. Since at the moment there are some other things that need to be decided on (such as sprite coordinate systems) and some other code implemented(e.g. a timing system, instead of using sdl.getTicks()), they are only rendering their spritesheets at the moment, as proof that we can load up a ZSprite and show something.

The example 03 for sprites isn't also done yet either, so I decided not to include the code. I'm only reserving the name.

Don't consider issue #13 done yet. This is only the first step.

define-private-public commented 6 years ago

I pushed an updated branch of this. Now you can see sprites animating!!

But the provided example doesn't match what I've been using for testing. What I need to resolve first:

  1. [ ] Origin & 3D coordinates problem
  2. [x] logic update problem (Don't use sdl2.getTicks())

I don't think I'm going to work on this anymore until those things get resolved.