Commit ef45944d authored by a.guest's avatar a.guest

Prog02Resit 2020 Initial Commit

parents
public class AnimatedObject extends GameObject {
// Used for any object in the game that is animated and/or moves
String spriteFile; // String containing the fuill path to a strite file
int spriteState; // Integer reprenting which sprite image is currently displayed
public AnimatedObject(int x, int y) {
super(x, y);
}
public AnimatedObject(int x, int y, String sprite, int state) {
super(x, y);
spriteFile = sprite;
spriteState = state;
}
@Override
public void draw() {
// Display the correct sprite image at the location positionX, positionY
}
public void update() {
// Change positionX, positionY if the object is moving
// Change spriteState based on what the AnimatedObject is doing
}
}
public class BackgroundObject extends GameObject {
// Used for static background objects that do not move or change
String imageFile; // String containing the full filename and path to image
public BackgroundObject(int x, int y) {
super(x, y);
}
public BackgroundObject(int x, int y, String image) {
super(x, y);
imageFile = image;
}
@Override
public void draw() {
// Code to draw imageFile to screen at positionX, positionY
}
}
public class EnemyObject extends AnimatedObject {
// Used for all enemy objects
public EnemyObject(int x, int y) {
super(x, y);
}
public EnemyObject(int x, int y, String sprite, int state) {
super(x, y);
spriteFile = sprite;
spriteState = state;
}
public void update() {
// Change positionX, positionY if the object is moving
// Change spriteState based on what the AnimatedObject is doing
}
public void processAI() {
// uses the AI to determine the enemy's actions
}
}
abstract class GameObject {
// Used for everything in the game that gets displayed on the screen
// Every object must have a location (x, y position)
int positionX; // Location x coordinate
int positionY; // Location y coordinate
public GameObject(int x, int y) {
positionX = x;
positionY = y;
}
public abstract void draw();
}
public class PlayerObject extends AnimatedObject {
// Used for the player avatar
public PlayerObject(int x, int y) {
super(x, y);
}
public PlayerObject(int x, int y, String sprite, int state) {
super(x, y);
spriteFile = sprite;
spriteState = state;
}
public void update() {
// Change positionX, positionY if the object is moving
// Change spriteState based on what the AnimatedObject is doing
}
public void processKeyboardInput() {
// Check for keyboard input to see if PlayerObject is being moved
}
}
{
"folders": [
{
"path": "."
}
],
"settings": {}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment