Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Start work on Map

  • Loading branch information...
commit b21d5ffa940449b6091fcfa4118d6fb35b866e9f 1 parent c1cf8a5
Thomas R. Koll authored
18 README.md
Source Rendered
@@ -32,16 +32,18 @@ score if some camera is waiting to get a shot of the surfers.
32 32 Trade your score for some hot speedos, flashy bikinis, boards, magic
33 33 mushrooms, or a tasty cheeseburger while you are at the beach.
34 34
35   -## Is is really roguelike?
  35 +## Is this really roguelike?
36 36
37 37 The checklist according to mikipedia:
38 38
39   -1. Prodecually generated, not could be more chaotic than waves
  39 +1. Prodecually generated, nothing could be more chaotic than waves
40 40 2. Turnbased combat (it sure is!)
41 41 3. Magic items (Magic Mushrooms from Old Willi's Hippy supply)
42 42 4. Permadeath (just wait till you fall and hit the rocks)
43 43 5. Single player
44 44
  45 +So it is, strangely, a roguelike.
  46 +
45 47 ## Screenshots
46 48
47 49 +-------+
@@ -54,12 +56,18 @@ The checklist according to mikipedia:
54 56
55 57 Surfer carrying a board
56 58
57   -
58 59 ## Credits
59 60
60   -* LÖVE2d
  61 +* LÖVE2d and the following libraries:
  62 + * Quickie
61 63 * ananasblau's own games Kollum and Cross Country Running
62 64
  65 +## Participate
  66 +
  67 +OneGameAMonth is about working together, that's why we share all this
  68 +sourcecode onto github, that's why you could contribute a few pieces to
  69 +this game. Art, music, code, mods, everything is possible.
  70 +
63 71 ## Authors
64   -* Thomas R. Koll (aka @ananasblau and @TomK32)
  72 +* Thomas R. Koll (aka @ananasblau and @TomK32) http://ananasblau.com/games
65 73
4 game.lua
@@ -25,8 +25,12 @@ function game:setMode(mode)
25 25 else
26 26 self:createFonts(0)
27 27 end
  28 + if self.view.updateDisplay then
  29 + self.view.updateDisplay()
  30 + end
28 31 end
29 32
30 33
31 34 function game:start()
  35 + game.current_state = MapState()
32 36 end
14 game_states/map_state.lua
... ... @@ -0,0 +1,14 @@
  1 +
  2 +require 'map'
  3 +require 'views/map_view'
  4 +
  5 +MapState = class("MapState", GameState)
  6 +function MapState:initialize()
  7 + self.map = Map(200, 200)
  8 + self.view = MapView(self, map)
  9 +end
  10 +
  11 +function MapState:draw()
  12 + self.view:draw()
  13 +end
  14 +
2  main.lua
@@ -10,10 +10,12 @@ require 'game'
10 10 require 'views/view'
11 11 require 'game_states/game_state'
12 12 require 'game_states/start_menu'
  13 +require 'game_states/map_state'
13 14
14 15 function love.load()
15 16 game:createFonts(0)
16 17 game.current_state = StartMenu()
  18 + game:start()
17 19 end
18 20
19 21 function love.draw()
41 map.lua
... ... @@ -0,0 +1,41 @@
  1 +-- As the map is going to be large (I'm thinking 1000x200 meters),
  2 +-- only sparsely populated, and changing quite often (waves),
  3 +-- a tiled map doesn't make that much sense.
  4 +-- Instead the map will manage only entities.
  5 +-- For a future optimization the map might be split up into smaller maps
  6 +
  7 +-- Entities are arranged in layers, each of which the map view has to draw
  8 +-- Entities are expected to have a position with x, y and z (layer)
  9 +-- and update and draw functions
  10 +
  11 +Map = class("Map")
  12 +function Map:initialize(width, height)
  13 + self.width = width
  14 + self.height = height
  15 + self.layers = {} -- here the entities are stuffed into
  16 + self.map = {}
  17 +end
  18 +
  19 +function Map:place(entity)
  20 + if not self.layers[entity.position.z] then
  21 + self.layers[entity.position.z] = {}
  22 + end
  23 + table.insert(self.layers[entity.position.z], entity)
  24 +end
  25 +
  26 +-- The map is wrapped, meaning if something leaves on one side it
  27 +-- reappears on the opposing side
  28 +function Map:fitIntoMap(position)
  29 + if position.x < 0 then
  30 + position.x = self.width
  31 + elseif position.x > self.width then
  32 + position.x = 0
  33 + end
  34 + if position.y < 0 then
  35 + position.y = self.height
  36 + elseif position.y > self.height then
  37 + position.y = 0
  38 + end
  39 + return position
  40 +end
  41 +

0 comments on commit b21d5ff

Please sign in to comment.
Something went wrong with that request. Please try again.