fragcastle / fragengine

our very own game engine and editor.
2 stars 1 forks source link

Allow Developers to specify an offset to Bounding Boxes #1

Closed codeimpossible closed 10 years ago

codeimpossible commented 11 years ago

As a game developer I would like to be able to specify a vector offset that should be applied to the current Actors BoundingBox. This would allow me to constrict the hit box for an actor and keep the animation positioned correctly.

codeimpossible commented 11 years ago

For version 1:

codeimpossible commented 10 years ago

I spent some time looking into this ticket today. The entity code isn't consistent in how it figures out where to place things on the screen.

codeimpossible commented 10 years ago

So, in order to complete this ticket I need to make these changes:

codeimpossible commented 10 years ago

I created a HitBox struct that stores the height and width of the hitbox and the offset that should be applied to it. The HitBox has some operator overloads that enable it to be added with Vector2 and Rectangle objects, developers can also explicitly create HitBox objects by casting from a Vector2 or a Rectangle:

var hitBox = (HitBox)( new Vector2( 100, 100 ) );

MonoGame.Framework contains a BoundingBox class but this is centered around Vector3 and since it is a struct, cannot be inherited ( so I couldn't extend it with the operator overloads ).

I'm not sold on this yet. I'm thinking of abandoning this and possibly using the BoundingBox class from MonoGame.Framework.

codeimpossible commented 10 years ago

I don't like how the HitBox keeps track of the offset. I feel like these are two different concepts and should be kept separate (the entity/game object should know how to use either one). Another problem is that the HitBox would need to know about it's position in the game world so that it can encapsulate the logic for applying the offset.

That feels like the HitBox would know way too much about it's use case(s) and would be prone to churn/bugs.