Old Style Game Framework How To..

Creating a Game with Old Style Game Framework.

This walk through create a side scroller game, where the player runs across the screen and jumps over obstacles. The walk through uses the Old Style Game Framework (1.0.2), Game Doc (1.2.3) and Game Designer (1.2.2).

Updated versions: Old Style Framework (1.1), Game Doc (1.3) and Game Designer (1.3)

06 package org.deken.sidescroller.states;
07 
08 import org.deken.game.state.GameState;
09 import org.deken.game.utils.GameLog;
10 import org.deken.gameDoc.document.GameDocument;
11 import org.deken.sidescroller.AdventureMap;
12 import org.deken.sidescroller.setup.MapSetup;
13 
14 /**
15  <p>
16  * Title: Active</p>
17  *
18  <p>
19  * Description: </p>
20  *
21  * Copyright: Copyright (c) Apr 1, 2015
22  *
23  @author Gary Deken <gary@abberkeep.us>
24  @version 1.0
25  */
26 public class Playing extends GameState {
27    private GameDocument gameDocument;
28    private MapSetup mapSetup;
29    private PlayerHit hit;
30 
31    public Playing(GameDocument gameDocument, MapSetup mapSetup, Start start) {
32       this.gameDocument = gameDocument;
33       this.mapSetup = mapSetup;
34       hit = new PlayerHit(gameDocument, start);
35 
36    }
37 
38    @Override
39    public void activateState() {
40       AdventureMap playMap = mapSetup.buildGameMap();
41 
42       hit.setMap(playMap);
43       playMap.setStates(this, hit);
44       gameCanvas.setGameMap(playMap);
45    }
46 
47    @Override
48    public void deactivateState() {
49       GameLog.log(getClass()"Deactivating Playing");
50    }
51 
52    @Override
53    public void update(long elapseTime) {
54 
55    }
56 
57    @Override
58    public String getName() {
59       return "Playing";
60    }
61 
62 }
Back