Skip to content

Commit

Permalink
Merge pull request #3 from alexcoder04/master
Browse files Browse the repository at this point in the history
Add navigation with number keys and create a Makefile for building with Luna
  • Loading branch information
jonasgeiler committed Oct 1, 2021
2 parents 82dda12 + aaf741c commit 82e619a
Show file tree
Hide file tree
Showing 42 changed files with 70 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minesweeper.tns
out.lua
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

build:
nspire-merge --out out.lua
luna out.lua minesweeper.tns

clean:
$(RM) out.lua
$(RM) minesweeper.tns

.PHONY: clean build

29 changes: 21 additions & 8 deletions Minesweeper.lua
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function on.timer()
platform.window:invalidate()
end

function on.arrowUp()
function goUp()
if gameover then return end

if cursorY - 1 > 0 then
Expand All @@ -103,7 +103,7 @@ function on.arrowUp()
end
end

function on.arrowDown()
function goDown()
if gameover then return end

if cursorY < numRows then
Expand All @@ -115,7 +115,7 @@ function on.arrowDown()
end
end

function on.arrowLeft()
function goLeft()
if gameover then return end

if cursorX - 1 > 0 then
Expand All @@ -127,7 +127,7 @@ function on.arrowLeft()
end
end

function on.arrowRight()
function goRight()
if gameover then return end

if cursorX < numCols then
Expand All @@ -139,12 +139,24 @@ function on.arrowRight()
end
end

function on.arrowUp() goUp() end
function on.arrowDown() goDown() end
function on.arrowLeft() goLeft() end
function on.arrowRight() goRight() end

function on.charIn(char)
if gameover then return end

if char == '' or char == 'f' then
flag()
end
if char == '' or char == 'f' then flag() return end
if char == '8' then goUp() return end
if char == '2' then goDown() return end
if char == '4' then goLeft() return end
if char == '6' then goRight() return end

if char == '7' then goUp() goLeft() return end
if char == '9' then goUp() goRight() return end
if char == '1' then goDown() goLeft() return end
if char == '3' then goDown() goRight() return end
end

function on.enterKey()
Expand Down Expand Up @@ -674,5 +686,6 @@ function reloadMenu()
toolpalette.enable("Marks", "Disable", false)
end
end

----------------------
----------------------
----------------------
Binary file removed Minesweeper.tns
Binary file not shown.
43 changes: 36 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@

# TI-Nspire Minesweeper

A simple Minesweeper-Clone made for the TI-Nspire with Lua.

The images used are from the original Minesweeper Game. I don't own them.<br>
**Warning:** This game is only tested on TI-Nspire CX and TI-Nspire CX CAS (OS Version 4.5), so there might be bugs on other platforms.
The images used are from the original Minesweeper Game. I don't own them.

**Warning:** This game is only tested on TI-Nspire CX and TI-Nspire CX CAS
(OS Version 4.5), so there might be bugs on other platforms.


# Screenshots
Expand All @@ -14,18 +18,43 @@ The images used are from the original Minesweeper Game. I don't own them.<br>


## Controls
Move Cursor = Arrow Keys<br>
Open Cell = Enter<br>
Flag Cell = (-) or F<br>
Press menu to change difficulty or to enable/disable marks.<br>

Move Cursor = Arrow Keys / Number Keys

Open Cell = Enter

Flag Cell = (-) or F

Press menu to change difficulty or to enable/disable marks.


## How to play

The goal of this game is to open all cells.
If you open a cell with a mine, you loose!
The numbers on the cells tell you how many mines there are in the 8 adjacent cells.
Flag a cell if you are sure that there is a mine under it.


## How to Build
The resources files needed to build the project can be imported in the script editor with their default names using the CX Student Software (every image in the resource folder needs to be imported).

### Using Luna

Make sure you have Luna (https://github.com/ndless-nspire/Luna) and
TI-Resource-Merge (https://github.com/DaveDuck321/TI-Resource-Merge) installed.
The merge script should be in your PATH as `nspire-merge`.

**Note:** since API version 2.3 (OS version >=3.6), support for inline-images
like generated by the merge script was removed, so you would need to require
an older API version. You can use my dirty fix in the merge script for that
(https://github.com/alexcoder04/TI-Resource-Merge).

Run `make` and it will generate the `minesweeper.tns` file which can be loaded
onto the calculator.

### Manually

The resources files needed to build the project can be imported in the script
editor with their default names using the CX Student Software (every image in
the resource folder needs to be imported).

Empty file modified res/IMG/border_corner_bottom_left.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified res/IMG/border_corner_bottom_right.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified res/IMG/border_corner_top_left.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified res/IMG/border_corner_top_right.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified res/IMG/border_horizontal.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified res/IMG/border_split_left.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified res/IMG/border_split_right.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified res/IMG/border_vertical.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified res/IMG/num0.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified res/IMG/num1.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified res/IMG/num2.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified res/IMG/num3.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified res/IMG/num4.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified res/IMG/num5.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified res/IMG/num6.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified res/IMG/num7.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified res/IMG/num8.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified res/IMG/num9.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified res/IMG/numMinus.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified res/IMG/smiley_cool.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified res/IMG/smiley_dead.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified res/IMG/smiley_smile.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified res/IMG/smiley_smile_pressed.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified res/IMG/tile_bomb.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified res/IMG/tile_clicked_bomb.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified res/IMG/tile_flag.png
100755 → 100644
Empty file modified res/IMG/tile_marked.png
100755 → 100644
Empty file modified res/IMG/tile_normal.png
100755 → 100644
Empty file modified res/IMG/tile_nothing.png
100755 → 100644
Empty file modified res/IMG/tile_num1.png
100755 → 100644
Empty file modified res/IMG/tile_num2.png
100755 → 100644
Empty file modified res/IMG/tile_num3.png
100755 → 100644
Empty file modified res/IMG/tile_num4.png
100755 → 100644
Empty file modified res/IMG/tile_num5.png
100755 → 100644
Empty file modified res/IMG/tile_num6.png
100755 → 100644
Empty file modified res/IMG/tile_num7.png
100755 → 100644
Empty file modified res/IMG/tile_num8.png
100755 → 100644

0 comments on commit 82e619a

Please sign in to comment.