Skip to content
This repository has been archived by the owner on Jan 4, 2023. It is now read-only.

Commit

Permalink
Fixes to PV8 renderer and cleaning up exit, respawn, and game over ti…
Browse files Browse the repository at this point in the history
…mers.
  • Loading branch information
jessefreeman committed Oct 4, 2021
1 parent 5ca32e1 commit 54ad181
Show file tree
Hide file tree
Showing 6 changed files with 221 additions and 387 deletions.
Binary file modified App/libs/Pixel Vision 8.dll
Binary file not shown.
35 changes: 14 additions & 21 deletions Game/Src/micro-platformer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ MicroPlatformer.__index = MicroPlatformer
function MicroPlatformer:Init()

-- Create a new object for the instance and register it
local _microPlatformer = {}
setmetatable(_microPlatformer, MicroPlatformer)
local _microPlatformer = {
grav = 0.2
}

setmetatable(_microPlatformer, MicroPlatformer)

--player information
_microPlatformer.player =
Expand All @@ -47,10 +49,11 @@ function MicroPlatformer:Init()
jumpvel = 3.0,
time = 0,
delay = .1,
grav = 0.2,
jumpSound = -1,
hitSound = -1,
spriteOffset = 0
spriteOffset = 0,
alive = true,
hasKey = false
}

return _microPlatformer
Expand Down Expand Up @@ -81,7 +84,9 @@ function MicroPlatformer:Update(timeDelta)
-- DrawRect(top.X, top.Y, 1, 1, 3, DrawMode.SpriteAbove)

-- Keep track of all the collision areas around the player
local currentFlag = Flag(math.floor(center.X/8), math.floor(center.Y/8))
self.currentFlagPos = NewPoint(math.floor(center.X/8), math.floor(center.Y/8))
self.currentFlag = Flag(self.currentFlagPos.X, self.currentFlagPos.Y)

-- DrawRect(math.floor(center.X/8) * 8, math.floor(center.Y/8) * 8, 8, 8, 9, DrawMode.SpriteBelow)


Expand All @@ -101,21 +106,8 @@ function MicroPlatformer:Update(timeDelta)
end
end

if(currentFlag == KEY) then

Tile(math.floor(center.X/8), math.floor(center.Y/8), -1)


elseif(currentFlag == GEM) then

Tile(math.floor(center.X/8), math.floor(center.Y/8), -1)

elseif(currentFlag == DOOR_OPEN) then


elseif(currentFlag == DOOR_OPEN) then

elseif(currentFlag == LADDER) then
-- Handle moving on the ladder
if(self.currentFlag == LADDER) then

grav = 0

Expand Down Expand Up @@ -192,6 +184,7 @@ function MicroPlatformer:Update(timeDelta)

print("Kill Player")

self.player.alive = false

elseif (bottomFlag == SOLID or bottomFlag == PLATFORM) then

Expand Down Expand Up @@ -262,7 +255,7 @@ function MicroPlatformer:Update(timeDelta)
self.spriteDir = self.player.dir

-- Climbing
if(currentFlag == LADDER) then
if(self.currentFlag == LADDER) then

self.player.spriteID = PLAYER_CLIMB

Expand Down
Loading

0 comments on commit 54ad181

Please sign in to comment.