Hi guys, I want explain my game design, I would appreciate any kind of comments and suggestion.
The game is a tile-map maze, with a logic similar to Pac-man:
-player
-various typologies of enemies
-bonus
I’ve implemented the following classes:
- the map class (contain the images of the tiles and a method called cantMove
that check if a particular location on the map is blocked) - the sprite class (contain a sprite to be displayed on the screen. don’t contains state information)
- the entity class (represents any element that appears in the game, setX()… setY()… setDirection etc…)
- the player class extends entity (is the entity that represents the player, it have also a method to check if it collides with another entity).
for my bonus and enemies class I’ve littles doubts:
Bonus class:
I’ve three types of bonus:
- A random positive bonus that casually appears in the map and it assigns a positive score
- A random negative bonus that casually appears in the map and it assigns a negative score
- A fixed bonus that player have to acquire to pass to the second level
What’s is the best way to implement bonus? I was thinking to create Bonus class extends Entity
and then create 3 subclasses (randomPos, randomNeg,Dollar)… it’s ok???
Enemy class:
I’ve two types of enemies:
- An enemy that moves Randomly
- An enemy that chase the player if possible, otherwise it moves randomly
So, I’ve implemented one enemy class that extends Entity.
I’ve also a Movement class with two methods: Random and Chase, if enemy type is 1 I call exclusively
Random method, otherwise, if enemy type is 2, first I call chase method and eventully Random method.
Movement class uses the “cantMove” method from map class.
I’m not sure about this last implementation (enemy, movement class)… what do you think about it?