Skip to content

Commit 336e6d3

Browse files
committed
Migrated Sokoban to v0.4:latest
1 parent cc38949 commit 336e6d3

File tree

15 files changed

+73
-53
lines changed

15 files changed

+73
-53
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
Include (Obe);
2-
31
Barrel:
42
Sprite:
53
path:"Sprites/GameObjects/Barrel/Barrel.png"
6-
rect:Rect<SceneUnits>(0.0, 0.0, 0.1, 0.1)
4+
rect:
5+
x:0.0
6+
y:0.0
7+
width:0.1
8+
height:0.1
9+
unit:"SceneUnits"
710
xTransform:"Camera"
811
yTransform:"Camera"
9-
layer:1.0
10-
z-depth:1.0
12+
layer:1
13+
zdepth:1
1114
Script:
12-
priority:0.0
15+
priority:0
1316
source:"Data/GameObjects/Barrel/Barrel.lua"
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
Include (Obe);
2-
31
Floor:
42
Sprite:
53
path:"Sprites/GameObjects/Floor/Floor.png"
6-
rect:Rect<SceneUnits>(0.0, 0.0, 0.1, 0.1)
4+
rect:
5+
x:0.0
6+
y:0.0
7+
width:0.1
8+
height:0.1
9+
unit:"SceneUnits"
710
xTransform:"Camera"
811
yTransform:"Camera"
9-
layer:1.0
10-
z-depth:1.0
12+
layer:1
13+
zdepth:1
1114
Script:
12-
priority:0.0
15+
priority:0
1316
source:"Data/GameObjects/Floor/Floor.lua"

Sokoban/Data/GameObjects/Game/Game.lua

+2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ function Local.Init()
1515
y = victory_sprite:getSize().y / camera_size.y
1616
}
1717

18+
print("Loading Scene Sokoban.map.vili");
1819
Engine.Scene:loadFromFile("Data/Maps/Sokoban.map.vili", function()
20+
print("================ OK SCENE LOADED ================")
1921
Engine.Scene:getGameObject("Terrain"):init(
2022
obe.System.Path("Data/Maps/level" .. Object.level .. ".txt"):find())
2123
end);
+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
Include (Obe);
2-
31
Game:
42
Script:
53
source:"Data/GameObjects/Game/Game.lua"
6-
permanent:True
4+
permanent:true
75

Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
Include (Obe);
2-
31
Objective:
42
Sprite:
53
path:"Sprites/GameObjects/Objective/Objective.png"
6-
rect:Rect<SceneUnits>(0.0, 0.0, 0.1, 0.1)
4+
rect:
5+
x:0.0
6+
y:0.0
7+
width:0.1
8+
height:0.1
9+
unit:"SceneUnits"
710
xTransform:"Camera"
811
yTransform:"Camera"
9-
layer:1.0
10-
z-depth:2.0
12+
layer:1
13+
zdepth:2
1114
Script:
12-
priority:0.0
15+
priority:0
1316
source:"Data/GameObjects/Objective/Objective.lua"

Sokoban/Data/GameObjects/Robot/Robot.lua

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ EndWalking = 2;
1515
NotWalking = 3;
1616

1717
function Local.Init(position)
18+
print("Beep boop");
19+
print("============= Initializing Robot", inspect(position));
1820
Terrain = Engine.Scene:getGameObject("Terrain");
1921
Object.pos = { x = position.x, y = position.y};
2022
Object.direction = "NONE";
@@ -28,6 +30,7 @@ function Local.Init(position)
2830
position.y * This.Sprite:getSize().y
2931
);
3032
This.Sprite:setPosition(pVec);
33+
print("Robot is done");
3134
end
3235

3336
function Object:getType()
@@ -39,6 +42,7 @@ function Object:getSprSize()
3942
end
4043

4144
function InitializeBindings()
45+
print("=============== Initializing Robot Bindings");
4246
for k, v in pairs(Directions) do
4347
Event.Actions[k] = function()
4448
if Object.walking == NotWalking and not Engine.Scene:getGameObject("Game").victory then
+10-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
Include (Obe);
2-
31
Robot:
42
Sprite:
5-
path:"Sprites/GameObjects/Robot/Robot_DOWN.png"
6-
rect:Rect<SceneUnits>(0.0, 0.0, 0.1, 0.1)
3+
path:"Sprites/GameObjects/Robot/Robot_DOWNd.png"
4+
rect:
5+
x:0.0
6+
y:0.0
7+
width:0.1
8+
height:0.1
9+
unit:"SceneUnits"
710
xTransform:"Camera"
811
yTransform:"Camera"
9-
layer:1.0
10-
z-depth:1.0
12+
layer:1
13+
zdepth:1
1114
Script:
12-
priority:0.0
15+
priority:0
1316
source:"Data/GameObjects/Robot/Robot.lua"
1417

Sokoban/Data/GameObjects/Terrain/Terrain.lua

+7
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,16 @@ function Object:uninit()
1717
end
1818

1919
function Object:init(path)
20+
print("Init terrain", path)
2021
if not Object.initialized and file_exists(path) then
2122
This:initialize();
23+
print("Terrain initialized");
2224
local lines = lines_from(path)
2325
local maxY;
2426
local maxX;
2527
local sprSize;
2628
local load_table = {};
29+
print("Lines", inspect(lines));
2730
for i, str in pairs(lines) do
2831
if maxY == nil or i>maxY then
2932
maxY = i;
@@ -37,12 +40,14 @@ function Object:init(path)
3740
load_table[i][j] = char;
3841
end
3942
end
43+
print("Loadtable", inspect(load_table));
4044
local offset = {x = (maxX/2), y = (maxY/2)};
4145
for i, v in pairs(load_table) do
4246
Object.elements[i] = {}
4347
for j, v2 in pairs(v) do
4448
if v2 ~= " " then
4549
local position = { x = j-1, y = i-1 };
50+
print("Loading element", v2);
4651
Object.elements[i][j] = blocFunctions[v2](position);
4752
if sprSize == nil then
4853
sprSize = Object.elements[i][j][1].getSprSize();
@@ -51,6 +56,7 @@ function Object:init(path)
5156
end
5257
end
5358

59+
print("Setting camera");
5460
local pVec = obe.Transform.UnitVector(
5561
offset.x * sprSize.x,
5662
offset.y * sprSize.y
@@ -63,6 +69,7 @@ function Object:init(path)
6369
local camera = Engine.Scene:getCamera();
6470
camera:setPosition(pVec, obe.Transform.Referential.Center);
6571
camera:scale(pSize, obe.Transform.Referential.Center);
72+
print("Terrain done :)");
6673
Object.initialized = true;
6774
end
6875
end
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Terrain:
22
Script:
3-
priority:0.0
3+
priority:0
44
source:"Data/GameObjects/Terrain/Terrain.lua"
55

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
Include (Obe);
2-
31
Wall:
42
Sprite:
53
path:"Sprites/GameObjects/Wall/Wall.png"
6-
rect:Rect<SceneUnits>(0.0, 0.0, 0.1, 0.1)
4+
rect:
5+
x:0.0
6+
y:0.0
7+
width:0.1
8+
height:0.1
9+
unit:"SceneUnits"
710
xTransform:"Camera"
811
yTransform:"Camera"
9-
layer:1.0
10-
z-depth:1.0
12+
layer:1
13+
zdepth:1
1114
Script:
12-
priority:0.0
15+
priority:0
1316
source:"Data/GameObjects/Wall/Wall.lua"

Sokoban/Data/Maps/Menu.map.vili

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
Include (Obe);
2-
Flag (Map);
3-
Flag (Lock);
4-
51
Meta:
62
name:"Menu"
73

84
View:
95
size:1.0
10-
pos:Vector2<SceneUnits>(0.0, 0.0)
11-
Referential:Referential<TopLeft>()
6+
position:
7+
x:0.0
8+
y:0.0
9+
unit:"SceneUnits"
10+
Referential:"TopLeft"
1211

1312
GameObjects:
1413
Game:

Sokoban/Data/Maps/Sokoban.map.vili

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
Include (Obe);
2-
Flag (Map);
3-
Flag (Lock);
4-
51
Meta:
62
name:"Sokoban"
73

84
View:
95
size:1.0
10-
pos:Vector2<SceneUnits>(0.0, 0.0)
11-
Referential:Referential<TopLeft>()
6+
position:
7+
x:0.0
8+
y:0.0
9+
unit:"SceneUnits"
10+
Referential:"TopLeft"
1211

1312
GameObjects:
1413
Terrain:

Sokoban/Data/config.cfg.vili

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
Define Flag (Settings);
2-
31
KeyBinding:
42
game:
53
UP:"Hold:Z"

Sokoban/Mount.vili

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
Include(Obe);
2-
31
Mount:
4-
Sokoban:Workspace("Sokoban", 1)
5-
Root:Path("", 0)
2+
Sokoban: Workspace { path: "Sokoban" }
3+
Root: Path
294 Bytes
Loading

0 commit comments

Comments
 (0)