dr.c needs time for reflection. away from the rut

Post on 13-Jan-2016

221 Views

Category:

Documents

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Dr.C

Needs time for reflection

Away From The Rut

In a Monastery

Down To Earth

But Up and Beyond!

A place to Contemplate

?

?

And to Seek out that Gate

To Discover Classes of Objects

By observing

Our Physical World.

What are the Classes?

Their Attributes?

Their Methods?

The essence of their being?

What are the Classes?

But His Students need security!

1. “Critically analyze and suitably modify a given object-oriented program design for a specified problem”

2. “Apply an object-oriented program design to code, document and test an appropriate program using advanced object-oriented techniques”.

3. “Critically evaluate an object-oriented program”.

Extend “negotiated” classes

Make and document a “game”

Evaluate your game :

• What You wanted to do

• How well the Java OOP worked to help you realize your intentions

• Problems I encountered with this OOP approach. How I solved them – or not!

Ie., … Assessment Info!

BasicTile

RoadTile

BuildingTile

ActiveTile

MyTile

GameObject

Player Tank BlueBall

MyGObj

Pickup

Crystal Bomb MyPickupGame GameGU

I

Platform Games

CBP March 2006

Tile-Space (i,j) = (14,10)Pixel-Space (x,y) = (280,200)

(3,2)

i

j

0 1 2 3 4

0

1

2

3

4

g2.drawImage(gObjIm,(int)xTL,(int)yTL,null);

public void convertIJtoXY() Centres the image in tile

Some Ideas for States

standingfalling

NO_LEDGE

ON_LEDGENO_LEDGEON_LEDGE

jumping

KEY_PRESS

Flat Games

Your TaskAn Idea – Something cool

• What Objects to I need?

• Tiles, players, bots, pickups?

• What is their behaviour ?

• How do I code this in a FSM ?

• Top Down Thinking

• Reflect on my whole idea

• What interactions to I need between all objects?

• Bottom Up Thinking

• Consider each object - its behaviour

• How do I code this as a FSM?

Or else – Total Thinking

• Consider the game I wish to make

• Objects (Player, Bots); Actions, Inter-Actions

• Components and the Whole

•How can our “negotiated classes” support this?

• extend existing classes

• write new classes

Your Task

Get Out there!

• Do some Research!

• Platform Games what are they?

• Look, Play, Analyze, Evaluate, THINK!

Look Around and Look Inside

• What excites me?

• Do I have an intention?

• Something simple (Safe Option) or something compleX. Or start simple then extend !

• A “Business Game”? An “Educational Game?”?

Your Task

Documenting your code with javadoc

/** * An ActiveTile is the substrate of the game to which other objects are added * * @param i horizontal coordinate in "tile-space" * @param j vertical coordinate in "tile-space" * @param name The name of the active tile graphic image * @param canvas The GameCanvas object where the active tiles are drawn */

public ActiveTile(int i, int j, String name, GameCanvas canvas) {

super(i,j,name,canvas); }

A. The Constructor1. Start of doc

2. End of doc

3. Parameters

Documenting your code with javadocB. Methods

/** Retrieves requested BasicTile from this tile, returns null if it not found * Call this method when you want to see if this tile contains a certain BasicTile * or subclass, eg "RoadTile" or "BuildingTile" or "MyTile" * @param objectClassName Any BasicTile subclass * @return The first BasicTile of the requested class found on this tile, or null if * there's none. */ public BasicTile getIfBasicTile(String objectClassName) {

return found; }

Documenting your code with javadoc

Building a Player step() method -0-

Remove Object from Tile

Look for Collision or Boundary

found

Calc new position

Look for Other Events

Add Object to Tile

Calc new position

Y

N

step() {

ActiveTile acTile = canvas.findActiveTile(i,j);

acTile.removeGameObjectFromContents(this);

int urgentEvent = boundaryDetect(vI,vJ);

if(urgentEvent == BOUNDARY) FSMPlayer(state,BOUNDARY);

if(urgentEvent == NO_EVENT){

FSMPlayer(state,event);

}

acTile = canvas.findActiveTile(i,j);

acTile.addGameObjectToContents(this);

}

Building a Player step() method -1-

Event here from Keyboard

1. Remove Object from Tile

2. Set new position

3. Or Set new position

4. Move to New Tile

step() {

... // EG check to see if we have hit a blue ball and take some action

BlueBall ball = (BlueBall)acTile.getIfGameObject("BlueBall");

if(ball != null) {

FSMPlayer(state,TOUCH_WITH_BLUE);

event = TOUCH_WITH_BLUE;

}

if(urgentEvent == NO_EVENT){

FSMPlayer(state,event);

}

}

Building a Player step() method -2-

No Collision or Boundary

top related