Skip to content

Commit e72605d

Browse files
Initial commit
0 parents  commit e72605d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2201
-0
lines changed

Diff for: .gitignore

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
2+
*.class
3+
*.log
4+
.DS_Store
5+
6+
# Windows specific
7+
null/
8+
9+
# Scala-cli specific
10+
.scala-build
11+
12+
# mill specific
13+
out
14+
publish.sh
15+
credentials.sh
16+
17+
# sbt specific
18+
sbt
19+
.sbt-local
20+
.cache
21+
.history
22+
.lib
23+
dist
24+
target
25+
lib_managed
26+
src_managed
27+
credentials.sbt
28+
29+
# IDE specific
30+
.idea
31+
*.iml
32+
.vscode/
33+
.vim
34+
.dotty-ide-disabled
35+
*.swp
36+
37+
node_modules
38+
.metals/
39+
.bloop
40+
metals.sbt
41+
.bsp/
42+
.ammonite
43+
.coursier
44+
45+
indigo/site/public/
46+
website/build/
47+
48+
# Direnv
49+
.direnv
50+
.envrc

Diff for: .mill-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.11.4

Diff for: .scalafix.conf

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
rules = [
2+
DisableSyntax,
3+
OrganizeImports
4+
]
5+
6+
OrganizeImports {
7+
removeUnused = false
8+
}
9+
10+
DisableSyntax {
11+
noVars = true
12+
noThrows = true
13+
noNulls = true
14+
noReturns = true
15+
noWhileLoops = true
16+
noAsInstanceOf = false # Doesn't seem to work correctly
17+
noIsInstanceOf = false # Doesn't seem to work correctly
18+
noXml = true
19+
noDefaultArgs = true
20+
noFinalVal = true
21+
noFinalize = true
22+
noValPatterns = true
23+
# noUniversalEquality = false # handled by scala 3
24+
# noUniversalEqualityMessage = "== and != are unsafe since they allow comparing two unrelated types"
25+
# regex = []
26+
}

Diff for: .scalafmt.conf

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version = 3.7.2
2+
runner.dialect = scala3
3+
style = defaultWithAlign
4+
maxColumn = 120
5+
rewrite.rules = [RedundantBraces,RedundantParens,PreferCurlyFors]
6+
danglingParentheses.preset = true

Diff for: README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Snake Demo
2+
3+
Play now! [https://purplekingdomgames.github.io/snake-demo/](https://purplekingdomgames.github.io/snake-demo/)
4+
5+
The Snake! game was the first Indigo game developed to prove that the engine worked!
6+
7+
![A screenshot of the snake demo](snake-demo.png)
8+
9+
## Running the demo
10+
11+
```
12+
./mill snake.runGame
13+
```

Diff for: assets/asset_dev/boxy_font.png

4.31 KB
Loading

Diff for: assets/asset_dev/gameover.mp3

24.9 KB
Binary file not shown.

Diff for: assets/asset_dev/snake-level-32x18.png

16.3 KB
Loading

Diff for: assets/asset_dev/snake-level-32x18.tmx

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<map version="1.0" tiledversion="1.1.3" orientation="orthogonal" renderorder="left-up" width="32" height="18" tilewidth="30" tileheight="30" infinite="0" nextobjectid="1">
3+
<tileset firstgid="1" source="snake-tiles-30x30.tsx"/>
4+
<layer name="Tile Layer 1" width="32" height="18">
5+
<data encoding="csv">
6+
5,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,7,
7+
13,29,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,31,15,
8+
13,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,39,15,
9+
13,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,39,15,
10+
13,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,39,15,
11+
13,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,39,15,
12+
13,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,39,15,
13+
13,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,39,15,
14+
13,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,39,15,
15+
13,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,39,15,
16+
13,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,39,15,
17+
13,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,39,15,
18+
13,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,39,15,
19+
13,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,39,15,
20+
13,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,39,15,
21+
13,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,39,15,
22+
13,45,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,47,15,
23+
21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23
24+
</data>
25+
</layer>
26+
</map>

Diff for: assets/asset_dev/snake-level-tilemap.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<tileset name="snake-tileset" tilewidth="32" tileheight="32" tilecount="64" columns="8">
3+
<image source="snake2.png" width="256" height="256"/>
4+
</tileset>

Diff for: assets/asset_dev/snake-level.json

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{ "height":14,
2+
"infinite":false,
3+
"layers":[
4+
{
5+
"data":[5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 13, 29, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 31, 15, 13, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 39, 15, 13, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 39, 15, 13, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 39, 15, 13, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 39, 15, 13, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 39, 15, 13, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 39, 15, 13, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 39, 15, 13, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 39, 15, 13, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 39, 15, 13, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 39, 15, 13, 45, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 47, 15, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23],
6+
"height":14,
7+
"name":"Tile Layer 1",
8+
"opacity":1,
9+
"type":"tilelayer",
10+
"visible":true,
11+
"width":20,
12+
"x":0,
13+
"y":0
14+
}],
15+
"nextobjectid":1,
16+
"orientation":"orthogonal",
17+
"renderorder":"left-up",
18+
"tiledversion":"1.1.3",
19+
"tileheight":32,
20+
"tilesets":[
21+
{
22+
"firstgid":1,
23+
"source":"snake-level-tilemap.tsx"
24+
}],
25+
"tilewidth":32,
26+
"type":"map",
27+
"version":1,
28+
"width":20
29+
}

Diff for: assets/asset_dev/snake-level.tmx

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<map version="1.0" tiledversion="1.1.3" orientation="orthogonal" renderorder="left-up" width="20" height="14" tilewidth="32" tileheight="32" infinite="0" nextobjectid="1">
3+
<tileset firstgid="1" source="snake-level-tilemap.tsx"/>
4+
<layer name="Tile Layer 1" width="20" height="14">
5+
<data encoding="csv">
6+
5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,
7+
13,29,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,31,15,
8+
13,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,39,15,
9+
13,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,39,15,
10+
13,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,39,15,
11+
13,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,39,15,
12+
13,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,39,15,
13+
13,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,39,15,
14+
13,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,39,15,
15+
13,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,39,15,
16+
13,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,39,15,
17+
13,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,39,15,
18+
13,45,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,47,15,
19+
21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23
20+
</data>
21+
</layer>
22+
</map>

Diff for: assets/asset_dev/snake-tiles-30x30.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<tileset name="snake-tiles-30x30" tilewidth="30" tileheight="30" tilecount="64" columns="8">
3+
<image source="snake4.png" width="256" height="256"/>
4+
</tileset>

Diff for: assets/asset_dev/snake.ase

919 Bytes
Binary file not shown.

Diff for: assets/asset_dev/snake4.ase

2.93 KB
Binary file not shown.

Diff for: assets/asset_dev/snake4.png

2.91 KB
Loading

Diff for: assets/asset_dev/start.mp3

24.9 KB
Binary file not shown.

Diff for: assets/boxy_font_small.png

2.01 KB
Loading

Diff for: assets/intro.mp3

119 KB
Binary file not shown.

Diff for: assets/lose.mp3

20.4 KB
Binary file not shown.

Diff for: assets/point.mp3

19.6 KB
Binary file not shown.

Diff for: assets/snake.png

162 Bytes
Loading

Diff for: build.sc

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
import scala.util.Success
2+
import scala.util.Try
3+
import $ivy.`com.lihaoyi::mill-contrib-bloop:$MILL_VERSION`
4+
import mill._
5+
import mill.scalalib._
6+
import mill.scalajslib._
7+
import mill.scalajslib.api._
8+
import mill.scalalib.scalafmt._
9+
import coursier.maven.MavenRepository
10+
11+
import $ivy.`io.indigoengine::mill-indigo:0.15.0`, millindigo._
12+
13+
import $ivy.`io.github.davidgregory084::mill-tpolecat::0.3.5`
14+
import io.github.davidgregory084.TpolecatModule
15+
16+
object snake extends MillIndigo with TpolecatModule with ScalafmtModule {
17+
def scalaVersion = "3.3.1"
18+
def scalaJSVersion = "1.13.2"
19+
20+
val indigoOptions: IndigoOptions =
21+
IndigoOptions.defaults
22+
.withTitle("Snake - Made with Indigo")
23+
.withWindowWidth(720)
24+
.withWindowHeight(516)
25+
.withBackgroundColor("black")
26+
.excludeAssets {
27+
case p if p.startsWith(os.RelPath("asset_dev")) => true
28+
case _ => false
29+
}
30+
31+
val indigoGenerators: IndigoGenerators =
32+
IndigoGenerators
33+
.mill("snake.generated")
34+
.listAssets("Assets", indigoOptions.assets)
35+
.generateConfig("SnakeConfig", indigoOptions)
36+
37+
def buildGame() = T.command {
38+
T {
39+
compile()
40+
fastLinkJS()
41+
indigoBuild()()
42+
}
43+
}
44+
45+
def buildGameFull() = T.command {
46+
T {
47+
compile()
48+
fullLinkJS()
49+
indigoBuildFull()()
50+
}
51+
}
52+
53+
def runGame() = T.command {
54+
T {
55+
compile()
56+
fastLinkJS()
57+
indigoRun()()
58+
}
59+
}
60+
61+
def runGameFull() = T.command {
62+
T {
63+
compile()
64+
fullLinkJS()
65+
indigoRunFull()()
66+
}
67+
}
68+
69+
val indigoVersion = "0.15.0"
70+
71+
def ivyDeps = Agg(
72+
ivy"io.indigoengine::indigo-json-circe::$indigoVersion",
73+
ivy"io.indigoengine::indigo::$indigoVersion",
74+
ivy"io.indigoengine::indigo-extras::$indigoVersion"
75+
)
76+
77+
object test extends ScalaJSTests {
78+
79+
def ivyDeps = Agg(
80+
ivy"org.scalameta::munit::0.7.29"
81+
)
82+
83+
def testFramework = "munit.Framework"
84+
85+
override def moduleKind = T(mill.scalajslib.api.ModuleKind.CommonJSModule)
86+
87+
}
88+
89+
}

Diff for: flake.lock

+61
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: flake.nix

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
description = "indigo-game-dev";
3+
4+
inputs = {
5+
nixpkgs.url = github:nixos/nixpkgs/nixpkgs-unstable;
6+
flake-utils.url = github:numtide/flake-utils;
7+
};
8+
9+
outputs = { self, nixpkgs, flake-utils, ... }:
10+
flake-utils.lib.eachDefaultSystem (system:
11+
let
12+
pkgs = import nixpkgs {
13+
inherit system;
14+
overlays = [
15+
(f: p: {
16+
mill = p.mill.override { jre = p.jdk17_headless; };
17+
sbt = p.sbt.override { jre = p.jdk17_headless; };
18+
})
19+
];
20+
};
21+
jdk = pkgs.jdk17_headless;
22+
23+
24+
jvmInputs = with pkgs; [
25+
jdk
26+
coursier
27+
mill
28+
sbt
29+
];
30+
jvmHook = ''
31+
JAVA_HOME="${jdk}"
32+
'';
33+
34+
jsInputs = with pkgs; [
35+
nodejs
36+
yarn
37+
];
38+
jsHook = ''
39+
yarn install
40+
'';
41+
in
42+
{
43+
devShells.default = pkgs.mkShell {
44+
name = "indigo-game-dev-shell";
45+
buildInputs = jvmInputs ++ jsInputs;
46+
shellHook = jvmHook + jsHook;
47+
};
48+
}
49+
);
50+
51+
}

0 commit comments

Comments
 (0)