Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Start work on Map

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