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

24
Dr.C Needs time for reflection

Upload: katrina-austin

Post on 13-Jan-2016

220 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Dr.C Needs time for reflection. Away From The Rut

Dr.C

Needs time for reflection

Page 2: Dr.C Needs time for reflection. Away From The Rut

Away From The Rut

Page 3: Dr.C Needs time for reflection. Away From The Rut

In a Monastery

Page 4: Dr.C Needs time for reflection. Away From The Rut

Down To Earth

But Up and Beyond!

Page 5: Dr.C Needs time for reflection. Away From The Rut

A place to Contemplate

?

?

Page 6: Dr.C Needs time for reflection. Away From The Rut

And to Seek out that Gate

Page 7: Dr.C Needs time for reflection. Away From The Rut

To Discover Classes of Objects

By observing

Our Physical World.

Page 8: Dr.C Needs time for reflection. Away From The Rut

What are the Classes?

Their Attributes?

Their Methods?

The essence of their being?

Page 9: Dr.C Needs time for reflection. Away From The Rut

What are the Classes?

But His Students need security!

Page 10: Dr.C Needs time for reflection. Away From The Rut

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!

Page 11: Dr.C Needs time for reflection. Away From The Rut

BasicTile

RoadTile

BuildingTile

ActiveTile

MyTile

GameObject

Player Tank BlueBall

MyGObj

Pickup

Crystal Bomb MyPickupGame GameGU

I

Page 12: Dr.C Needs time for reflection. Away From The Rut

Platform Games

CBP March 2006

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

Page 13: Dr.C Needs time for reflection. Away From The Rut

(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

Page 14: Dr.C Needs time for reflection. Away From The Rut

Some Ideas for States

standingfalling

NO_LEDGE

ON_LEDGENO_LEDGEON_LEDGE

jumping

KEY_PRESS

Page 15: Dr.C Needs time for reflection. Away From The Rut

Flat Games

Page 16: Dr.C Needs time for reflection. Away From The Rut

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?

Page 17: Dr.C Needs time for reflection. Away From The Rut

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

Page 18: Dr.C Needs time for reflection. Away From The Rut

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

Page 19: Dr.C Needs time for reflection. Away From The Rut

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

Page 20: Dr.C Needs time for reflection. Away From The Rut

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; }

Page 21: Dr.C Needs time for reflection. Away From The Rut

Documenting your code with javadoc

Page 22: Dr.C Needs time for reflection. Away From The Rut

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

Page 23: Dr.C Needs time for reflection. Away From The Rut

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

Page 24: Dr.C Needs time for reflection. Away From The Rut

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