Skip to content

Commit

Permalink
v0.12 - Test level inside the custom level editor
Browse files Browse the repository at this point in the history
Closed #34 - Allow test level inside the editor
Closed #35 - The remote key pressed do not repeat on level editor
Fixed #33 - Level editor has poor performance in low end devices
Fixed #36 - The image thumbnails are painting the hidden ladders
  • Loading branch information
lvcabral committed Oct 4, 2016
1 parent eec98cc commit bff8f2f
Show file tree
Hide file tree
Showing 8 changed files with 341 additions and 230 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#####v0.12 - Test Custom Level
* Add: Allow test level inside the editor #34
* Change: Game remote key does not repeat on level editor #35
* Fix: Level editor has poor performance on low end devices #33
* Fix: Allow test level inside the editor #34
* Fix: The image thumbnails are painting the hidden ladders #36

#####v0.11 - Start Level Selection and Dynamic Map Thumbnails
* Add: Custom Level Editor #28
* Change: The button pressed to start level shall start executing the action relative to it #29
Expand Down
Binary file modified images/control_editor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions manifest
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
title=Lode Runner
subtitle=Roku remake of the Classic 8 bit Game
major_version=0
minor_version=11
build_version=337
minor_version=12
build_version=370
mm_icon_focus_hd=pkg:/images/icon_focus_hd.png
mm_icon_side_hd=pkg:/images/icon_focus_hd.png
mm_icon_focus_sd=pkg:/images/icon_side_hd.png
Expand Down
110 changes: 2 additions & 108 deletions source/charRunner.brs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
' ** Roku Lode Runner Channel - https://github.com/lvcabral/Lode-Runner-Roku
' **
' ** Created: September 2016
' ** Updated: September 2016
' ** Updated: October 2016
' **
' ** Remake in Brightscropt developed by Marcelo Lv Cabral - http://lvcabral.com
' ********************************************************************************************************
Expand All @@ -14,7 +14,7 @@ Function CreateRunner(level as object) as object
'Constants
this.const = m.const
'Controller
this.cursors = GetCursors(m.settings.controlMode)
this.cursors = GetControl(m.settings.controlMode)
this.sounds = m.sounds
'Properties
this.charType = "runner"
Expand Down Expand Up @@ -119,112 +119,6 @@ Function can_dig() as boolean
return rsp
End Function

Function GetCursors(controlMode as integer) as object
this = {
code: bslUniversalControlEventCodes()
up: false
down: false
left: false
right: false
dig: false
digLeft: false
digRight: false
}
if controlMode = m.const.CONTROL_VERTICAL
this.update = update_cursor_vertical
else
this.update = update_cursor_horizontal
end if
this.reset = reset_cursors
return this
End Function

Sub update_cursor_vertical(id as integer, shiftToggle as boolean)
if id = m.code.BUTTON_UP_PRESSED
m.up = true
m.down = false
else if id = m.code.BUTTON_DOWN_PRESSED
m.up = false
m.down = true
else if id = m.code.BUTTON_LEFT_PRESSED
m.left = true
m.right = false
else if id = m.code.BUTTON_RIGHT_PRESSED
m.left = false
m.right = true
else if id = m.code.BUTTON_SELECT_PRESSED
m.dig = true
else if id = m.code.BUTTON_REWIND_PRESSED
m.digLeft = true
m.dig = true
else if id = m.code.BUTTON_FAST_FORWARD_PRESSED
m.digRight = true
m.dig = true
else if id = m.code.BUTTON_UP_RELEASED
m.up = false
else if id = m.code.BUTTON_DOWN_RELEASED
m.down = false
else if id = m.code.BUTTON_LEFT_RELEASED
m.left = false
else if id = m.code.BUTTON_RIGHT_RELEASED
m.right = false
else if id = m.code.BUTTON_SELECT_RELEASED
m.dig = false
else if id = m.code.BUTTON_REWIND_RELEASED
m.digLeft = false
m.dig = false
else if id = m.code.BUTTON_FAST_FORWARD_RELEASED
m.digRight = false
m.dig = false
end if
End Sub

Sub update_cursor_horizontal(id as integer, shiftToggle as boolean)
if id = m.code.BUTTON_RIGHT_PRESSED
m.up = true
else if id = m.code.BUTTON_LEFT_PRESSED
m.down = true
else if id = m.code.BUTTON_UP_PRESSED
m.left = true
else if id = m.code.BUTTON_DOWN_PRESSED
m.right = true
else if id = m.code.BUTTON_SELECT_PRESSED
m.dig = true
else if id = m.code.BUTTON_A_PRESSED
m.digLeft = true
m.dig = true
else if id = m.code.BUTTON_B_PRESSED
m.digRight = true
m.dig = true
else if id = m.code.BUTTON_RIGHT_RELEASED
m.up = false
else if id = m.code.BUTTON_LEFT_RELEASED
m.down = false
else if id = m.code.BUTTON_UP_RELEASED
m.left = false
else if id = m.code.BUTTON_DOWN_RELEASED
m.right = false
else if id = m.code.BUTTON_SELECT_RELEASED
m.dig = false
else if id = m.code.BUTTON_A_RELEASED
m.digLeft = false
m.dig = false
else if id = m.code.BUTTON_B_RELEASED
m.digRight = false
m.dig = false
end if
End Sub

Sub reset_cursors()
m.up = false
m.down = false
m.left = false
m.right = false
m.dig = false
m.digLeft = false
m.digRight = false
End Sub

Function key_u() as boolean
return m.cursors.up
End Function
Expand Down
8 changes: 6 additions & 2 deletions source/gameMenu.brs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
' ** Roku Lode Runner Channel - https://github.com/lvcabral/Lode-Runner-Roku
' **
' ** Created: September 2016
' ** Updated: September 2016
' ** Updated: October 2016
' **
' ** Remake in Brightscropt developed by Marcelo Lv Cabral - http://lvcabral.com
' ********************************************************************************************************
Expand Down Expand Up @@ -58,7 +58,11 @@ Function StartMenu(focus as integer) as integer
end if
if res < m.const.MESSAGEBOX_CANCEL then exit while
else if selection = m.const.MENU_VERSION
background = CreateObject("roImageCanvas")
background.Show()
selected = SelectStartLevel(m.settings.spriteMode, m.settings.version, m.settings.startLevel, this.port)
background.Close()
background = invalid
if selected > 0 and m.settings.version = m.const.VERSION_CUSTOM
m.settings.startLevel = selected
exit while
Expand Down Expand Up @@ -431,7 +435,7 @@ Function GetLevelMapImage(spriteMode as integer, versionId as integer, levelId a
for ty = m.const.TILES_Y-1 to 0 step -1
for tx = m.const.TILES_X-1 to 0 step -1
tile = level.map[tx][ty]
if tile.bitmap <> invalid
if tile.bitmap <> invalid and tile.base <> m.const.MAP_HLADR
tileRegion = m.regions.tiles.Lookup(tile.bitmap)
if tileRegion <> invalid
x = tx * m.const.TILE_WIDTH
Expand Down
24 changes: 14 additions & 10 deletions source/gameScreen.brs
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,17 @@
' ** Roku Lode Runner Channel - https://github.com/lvcabral/Lode-Runner-Roku
' **
' ** Created: September 2016
' ** Updated: September 2016
' ** Updated: October 2016
' **
' ** Remake in Brightscropt developed by Marcelo Lv Cabral - http://lvcabral.com
' ********************************************************************************************************
' ********************************************************************************************************

Function PlayGame() as boolean
Function PlayGame(testMode = false as boolean) as boolean
'Clear screen (needed for non-OpenGL devices)
m.mainScreen.Clear(0)
m.mainScreen.SwapBuffers()
m.mainScreen.Clear(0)
'Set offsets
m.canvasX = Cint((m.mainWidth - m.gameWidth) / 2)
m.canvasY = Cint((m.mainHeight - m.gameHeight) / 2)
'Initialize flags and aux variables
m.guardsMoves = [[0, 0, 0], [0, 1, 1], [1, 1, 1], [1, 2, 1], [1, 2, 2], [2, 2, 2], [2, 2, 3]]
if m.isOpenGL
Expand All @@ -37,6 +34,7 @@ Function PlayGame() as boolean
if id = m.code.BUTTON_BACK_PRESSED
StopAudio()
DestroyChars()
DestroyStage()
exit while
else if id = m.code.BUTTON_INSTANT_REPLAY_PRESSED
m.runner.alive = false
Expand All @@ -47,14 +45,14 @@ Function PlayGame() as boolean
m.runner.health++
m.runner.usedCheat = true
end if
else if ControlNextLevel(id)
else if ControlNextLevel(id) and not testMode
NextLevel()
m.runner.usedCheat = true
else if ControlPreviousLevel(id)
else if ControlPreviousLevel(id) and not testMode
PreviousLevel()
m.runner.usedCheat = true
else
m.runner.cursors.update(id, false)
m.runner.cursors.update(id)
end if
id = -1
else if event = invalid
Expand Down Expand Up @@ -87,15 +85,21 @@ Function PlayGame() as boolean
else
m.gameOver = true
end if
else if testMode
m.gameOver = m.runner.success
else
m.gameOver = CheckLevelSuccess()
end if
end if
if m.gameOver
GameOver()
changed = false
StopAudio()
changed = CheckHighScores()
if not testMode
GameOver()
changed = CheckHighScores()
end if
DestroyChars()
DestroyStage()
return changed
end if
end if
Expand Down
110 changes: 109 additions & 1 deletion source/gameUtil.brs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
' ** Roku Lode Runner Channel - https://github.com/lvcabral/Lode-Runner-Roku
' **
' ** Created: September 2016
' ** Updated: September 2016
' ** Updated: October 2016
' **
' ** Remake in Brightscropt developed by Marcelo Lv Cabral - http://lvcabral.com
' ********************************************************************************************************
Expand Down Expand Up @@ -437,3 +437,111 @@ Function padLeft(text as string, size as integer) as string
end if
return text
End Function

'------- Remote Control Functions -------

Function GetControl(controlMode as integer) as object
this = {
code: bslUniversalControlEventCodes()
up: false
down: false
left: false
right: false
dig: false
digLeft: false
digRight: false
}
if controlMode = m.const.CONTROL_VERTICAL
this.update = update_control_vertical
else
this.update = update_control_horizontal
end if
this.reset = reset_control
return this
End Function

Sub update_control_vertical(id as integer)
if id = m.code.BUTTON_UP_PRESSED
m.up = true
m.down = false
else if id = m.code.BUTTON_DOWN_PRESSED
m.up = false
m.down = true
else if id = m.code.BUTTON_LEFT_PRESSED
m.left = true
m.right = false
else if id = m.code.BUTTON_RIGHT_PRESSED
m.left = false
m.right = true
else if id = m.code.BUTTON_SELECT_PRESSED
m.dig = true
else if id = m.code.BUTTON_REWIND_PRESSED
m.digLeft = true
m.dig = true
else if id = m.code.BUTTON_FAST_FORWARD_PRESSED
m.digRight = true
m.dig = true
else if id = m.code.BUTTON_UP_RELEASED
m.up = false
else if id = m.code.BUTTON_DOWN_RELEASED
m.down = false
else if id = m.code.BUTTON_LEFT_RELEASED
m.left = false
else if id = m.code.BUTTON_RIGHT_RELEASED
m.right = false
else if id = m.code.BUTTON_SELECT_RELEASED
m.dig = false
else if id = m.code.BUTTON_REWIND_RELEASED
m.digLeft = false
m.dig = false
else if id = m.code.BUTTON_FAST_FORWARD_RELEASED
m.digRight = false
m.dig = false
end if
End Sub

Sub update_control_horizontal(id as integer)
if id = m.code.BUTTON_RIGHT_PRESSED
m.up = true
else if id = m.code.BUTTON_LEFT_PRESSED
m.down = true
else if id = m.code.BUTTON_UP_PRESSED
m.left = true
else if id = m.code.BUTTON_DOWN_PRESSED
m.right = true
else if id = m.code.BUTTON_SELECT_PRESSED
m.dig = true
else if id = m.code.BUTTON_A_PRESSED
m.digLeft = true
m.dig = true
else if id = m.code.BUTTON_B_PRESSED
m.digRight = true
m.dig = true
else if id = m.code.BUTTON_RIGHT_RELEASED
m.up = false
else if id = m.code.BUTTON_LEFT_RELEASED
m.down = false
else if id = m.code.BUTTON_UP_RELEASED
m.left = false
else if id = m.code.BUTTON_DOWN_RELEASED
m.right = false
else if id = m.code.BUTTON_SELECT_RELEASED
m.dig = false
else if id = m.code.BUTTON_A_RELEASED
m.digLeft = false
m.dig = false
else if id = m.code.BUTTON_B_RELEASED
m.digRight = false
m.dig = false
end if
End Sub

Sub reset_control()
m.up = false
m.down = false
m.left = false
m.right = false
m.dig = false
m.digLeft = false
m.digRight = false
End Sub
Loading

0 comments on commit bff8f2f

Please sign in to comment.