Tuesday, 15 March 2011

Engine 5.14 released

This is the latest update, which has gone through a couple of iterations while I added relevant support structures for tile map collision systems and their associated helper methods.

I also fixed a really stupid bug from way back when I re-wrote the entire event system in version 4.00 of the engine.

Engine5.14

It is not necessary to update to this version of the engine, the change was for a specific purpose.

Bugs fixed in this release
==========================
EventManager006 - The Pause() method of Event had no code in it! doh!, so techincally this was an Event class bug not an EventManager class bug

Map001 - fixed wrapping issue on tile location checking (didn't list on buglist because not public at the time)


changes in this release
=======================
PointHelper - new class added
Map - new class added
Sprite - addition to class


==============
New class PointHelper
==============
This class contains lots of methods for helping with Point values, this is useful for logic within tilemap games

Same() - added, determines if two Point values contain the same X and Y values

Distance() - added, works out the distance (in Point co-ordinates) of two Point values (grid positions)

DistanceInt() - added, same as above but rounds to an Integer value

DistanceSquared() - added, works out the distance squared between two point values, this is quicker than Distance as it doesn't perform the square root operation and is good enough if you just want to compare relative distances rather than exact distances between points

DistanceSqauredInt() - added, same as above but returns an Integer version

MultiplyScalar() - added, multiplies a Point by a single value e.g. Point(3,4) * 4 would be Point (12, 16)

Subtract() - added, subtracts one Point Value from another

Add() - added, adds two point values together

Vector2FromPoint() - added, converts a Point value to a Vector2 equivalent

PointFromVector2() - added, converts a Vector2 value to an equivalent Point value


==============
New class Map
==============

Added a new class that is a starting point for tile based games (mazes etc...). This conatins some common functionality required, its simple now but will become more fully featured in future as I work on this. You should really inherit from this class so you can add extension fields and methods to suit the purpose of your map.

Map() - Constructor for a new Map, where you specify the width and height of a single tile in the map

LEFT, RIGHT, UP, DOWN - added, these should be used for stating and comparing directions in the map

tileMap - holds the tilemap for your level

collisionMap - holds the collision map for your level (if this needs to be different to the tilemap)

HeightPhysical - gets the physical pixel height of the map when drawn

WidthPhysical - gets the physical pixel width of the map when drawn

collisionBlocks - holds an array of integer values that specify differnt collision blocks (use these to populate your collision map from the image tiles held in your tileMap by defining the override method of the virtual method DefineCollisionBlocks.

width - holds the width of the tileMap in tiles

height - holds the height of the tileMap in tiles

collisionHeight - holds the height of the collisionMap in collision tiles

collisionWidth - holds the width of the collisionMap in the collision tiles

offset - holds the the x and y draw start position (if used) for the tilemap

tileWidth - holds the width of an individual tile

tileHeight - holds the height of an individual tile

actorStart - holds an array of points that can be used to specify the starting points of actors (objects) within your tilemap

DefineCollisionBlocks - a virtual method (that you need to implement) in order to create collision blocks and hence a collision map if needed

CreateCollisionMap() - a virtual method (that you can override) that takes the collisionblocks you defined in the method above and translates the tilemap into a collisionmap. The base function just creates a collision map of the same size, but if you override this you can easily make more complex collision maps if needed.

CentreLevel() - method which using either a rectangle of specifc width and height, to attempt to centre the tilemap within.

CollisionItemHere() - a method which interrogate the collisionMap to see of a particular value exists at the given location (you can look for a single or an array of values)

TileItemHere() - a method which interrogate the tileMapto see of a particular value exists at the given location (you can look for a single or an array of values)

TileLocation() - get the corresponding tile location given the pixel (x,y) co-ordinates given

TileLeft() - gets the location of a tile so many position Left of the one given

TileRight() - as above but right

TileUp() - as above but up

TileDown() - as above but down

CollisionLegalMove() - determines if a proposed move from a specific tile will be legal, by examining the collisionMap

TileLegalMove() - as above but looks at the tileMap

Contains() - determines if a single integer is within an array of integers

CollisionValidDirections() - returns an array of valid directions from a given collision tile location by looking at the collisionMap

TileValidDirections() - as above but looks at the tileMap

PositionFromTile() - returns the X,Y pixel position of the top left corner of the specified tile

ActorPosition() - returns the tile the centre of an actor is occupying based on its pixel position

ActorAtCentre() - determines if the actor is near the centre of a tile within a certain tolerance

SetAtTopLeftOfTile() - places an actor sprite at the top left corner of the given tile, you need to be aware of sprite alignment mode to get the effect you want

SetToCentre() - as above but places the actor at the centre position of a given tile

CollisionDirections() - returns a list of directions from a given tile where a list of tile types exist in the collisionMap

TileDirections() - as above but looks in the tileMap



==============
Sprite
==============

Associations - added, a list of objects can now be associated with a sprite, this allows you to store references to any types of data you wish. You need to manage this yourself though. I have left SpecialObject (for back compatability) but it should not need to be used anymore

No comments:

Post a Comment