ashish2199 / Aidos

A beginner friendly project with aim of creating our own version of Bomberman.
GNU General Public License v3.0
41 stars 27 forks source link

Character entity and new animation system #14

Closed ItsStolas closed 6 years ago

ItsStolas commented 6 years ago

Created Animator.java

You give this class a graphics context, the X and Y coordinates on the sprite.jpeg that we are currently using, the size of the image to display, how many pixel to jump across for the next frame and the number of frames. The animator will then draw the animation correctly, at a defined speed.

Created CharacterEntity.java

This is just a basic class for characters. I know we said we weren't going to do this, but I thought I'd show a concrete example of what I meant anyway. In the case we don't want to go with it, we can always just turn it into the PlayerEntity instead. It just contains a crappy implementation of move(), an idea for adding sprites etc.

Created PlayerEntity.java

This extends CharacterEntity and adds its' own move sprites.

Created Sprite.java

Created this to avoid passing huge arguments to the Animator, but now you have to pass huge arguments to sprite! Oh boy. I figured this would let us extend the sprite system easier, anyway. Hopefully.

Altered Bomberman.java

I struggled to get this to work with Sandbox. Maybe someone else can take a look at it? I added a basic game loop (Ala, https://gamedevelopment.tutsplus.com/tutorials/introduction-to-javafx-for-game-development--cms-23835)

I think this will work well with keeping everything in sync.

Some thoughts We could easily split the sprites up into sprite sheets, and tell the Animator.java which sprite sheet to use when it is being called. This might work well if we want to make more high-quality animations. I also still need to add an "Auto_Reverse" option to Animator.java.

ItsStolas commented 6 years ago

I've kind of stormed ahead with the new animation system. Not sure how to handle it in Git, so I closed the old pull request and made this one. I feel like I'm adding too much without it being reviewed at the moment.

You can test it by going to Bomberman.java and changing the move function manually :)

ItsStolas commented 6 years ago

I'll stop here till someone looks at it. I realise it looks huge, but hopefully, it's easy to follow.

ashish2199 commented 6 years ago

@CoreyHendrey Yeah please don't, until this gets reviewed.

ItsStolas commented 6 years ago

No worries :) I got a bit carried away.

ItsStolas commented 6 years ago

Is this going to be merged or can I just close it?

ashish2199 commented 6 years ago

It will be merged but not fully I am working on seeing what all I should leave out.

ashish2199 commented 6 years ago

Sorry for keeping your pull request open for so long, I was finding it hard to take out time. I was thinking of creating animations which will run independently but now I feel your approach is better as it will keep everything in sync, Getting to keep these animations running smoothly and in sync would be a bit hard to implement. Please from now on don't deviate from our design, in case you need to then please discuss it first using a issue. Also please don't put so many new things in one pull request.

Thanks for contributing.