diff --git a/art/sprites/bananna.png b/art/sprites/bananna.png new file mode 100644 index 0000000..804655b Binary files /dev/null and b/art/sprites/bananna.png differ diff --git a/art/sprites/bananna.wb b/art/sprites/bananna.wb new file mode 100644 index 0000000..68a9abe Binary files /dev/null and b/art/sprites/bananna.wb differ diff --git a/main.lua b/main.lua index 872aeb0..6845528 100644 --- a/main.lua +++ b/main.lua @@ -180,6 +180,7 @@ function game_draw () map:draw() player:draw() + bananna:draw() camera:detach() camera:draw() @@ -208,6 +209,11 @@ function game_keypressed(key) player.following = true elseif (key == "f" and player.following == true) then player.following = false + + elseif (key == "=" and camera.scale < 10) then + camera.scale = camera.scale + 1 + elseif (key == "-" and camera.scale > 1) then + camera.scale = camera.scale - 1 end end @@ -424,6 +430,25 @@ end +-- BANNANA owo (win condition obj) +---------------------------------------- +Bananna = class('Bananna') +world:addCollisionClass('Bananna') + +function Bananna:initialize(x, y) + self.sprite = love.graphics.newImage("art/sprites/bananna.png") + self.collider = world:newRectangleCollider(x, y, 16, 16); +end + + +function Bananna:draw() + local col = self.collider + local x,y = col.body:getWorldPoints(col.shape:getPoints()) + love.graphics.draw(self.sprite, x, y, col.body:getAngle(), 1, 1) +end + + + -- MAP used to store map data (ofc) ---------------------------------------- Map = class('Map') @@ -437,6 +462,9 @@ function Map:initialize(filepath) local maptable = dofile(filepath) love.graphics.setBackgroundColor(146/255, 187/255, 203/255) + local monkCount = 3 + local monkX,monkY = 100,100 + local banannaX,banannaY = 200,200 for n,layer in pairs(maptable.layers) do if not (layer.type == "objectgroup") then break; end @@ -452,15 +480,19 @@ function Map:initialize(filepath) self.objects[o_c]:setCollisionClass('Platform') elseif (object.shape == "point" and object.type == "spawn") then - local monkCount = 3 if not (object.properties == nil and object.properties["count"] == nil) then monkCount = object.properties["count"] end - player = Monk:new(object.x, object.y, monkCount) + monkX,monkY = object.x,object.y + + elseif (object.shape == "point" and object.type == "bananna") then + banannaX,banannaY = object.x,object.y end end end + player = Monk:new(monkX, monkY, monkCount) + bananna = Bananna:new(banannaX, banannaY) end diff --git a/maps/README.txt b/maps/README.txt index 8f49e5d..c770b55 100644 --- a/maps/README.txt +++ b/maps/README.txt @@ -9,4 +9,13 @@ Text-box formatting will be ignored, but the text is used. You can set the spawn point of the monkey party with a point object of type "spawn". Otherwise, it defaults to (100,100). +You can place the bannanas in the map with a point object of type "bannana". +Otherwise... it'll just pop up in (200,200). + Export your map to Lua, put it in a custom "maps" folder, and you're good to go! + + +Useful bits +---------------------------------------- +The farthest a monkey can jump horizontally is 15 16x16 squares +The highest a monkey can jump vertically is 5 16x16 squares diff --git a/maps/tutorial/1.lua b/maps/tutorial/1.lua index aec8612..81709d4 100644 --- a/maps/tutorial/1.lua +++ b/maps/tutorial/1.lua @@ -9,7 +9,7 @@ return { tilewidth = 16, tileheight = 16, nextlayerid = 5, - nextobjectid = 34, + nextobjectid = 46, properties = {}, tilesets = {}, layers = { @@ -35,37 +35,22 @@ return { height = 17, rotation = 0, visible = true, - text = "Hello, monkeys.", + text = "move with wasd or arrow keys", wrap = true, properties = {} }, { - id = 30, + id = 38, name = "", type = "", shape = "text", - x = 132.961, - y = 50.8333, + x = 1102.96, + y = 312.833, width = 82.0781, height = 17, rotation = 0, visible = true, - text = "You're hungry, aren't you?", - wrap = true, - properties = {} - }, - { - id = 31, - name = "", - type = "", - shape = "text", - x = 230.294, - y = 70.8333, - width = 82.0781, - height = 17, - rotation = 0, - visible = true, - text = "Go on ahead, then.", + text = "hit 'space' to create a platform", wrap = true, properties = {} } @@ -328,6 +313,19 @@ return { rotation = 0, visible = true, properties = {} + }, + { + id = 43, + name = "", + type = "", + shape = "rectangle", + x = 1370, + y = 236, + width = 222.667, + height = 77.3333, + rotation = 0, + visible = true, + properties = {} } } }, @@ -356,6 +354,19 @@ return { properties = { ["count"] = 4 } + }, + { + id = 45, + name = "", + type = "bananna", + shape = "point", + x = 1484, + y = 240, + width = 0, + height = 0, + rotation = 0, + visible = true, + properties = {} } } } diff --git a/maps/tutorial/1.tmx b/maps/tutorial/1.tmx index 244016f..66c4fac 100644 --- a/maps/tutorial/1.tmx +++ b/maps/tutorial/1.tmx @@ -1,17 +1,14 @@ - + - Hello, monkeys. + move with wasd or arrow keys - - You're hungry, aren't you? - - - Go on ahead, then. + + hit 'space' to create a platform @@ -34,6 +31,7 @@ + @@ -42,5 +40,8 @@ + + +