uh, a lot happened, i murdered physics code, redesigned tiles & levels, now i need to make another level editor. I'm sorry game. I'm sorry git.
This commit is contained in:
parent
8607399d16
commit
dd2debc0bd
Binary file not shown.
Before Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
|
@ -1 +0,0 @@
|
||||||
[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[202,202,202,202,202,202,202,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,202,0,202,202,202,202,202,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,202,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,202,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,202,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,202,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,202,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,202,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,202,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,202,202,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,106,106,106,106,106,106,106,106,109,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,119,119,119,119,119,119,119,119,130,109,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,119,119,119,119,119,119,119,119,119,130,109,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,119,119,119,119,119,119,119,119,119,119,130,109,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,119,119,119,119,119,119,119,119,119,119,119,130,106,106,106,106,106,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]
|
|
File diff suppressed because one or more lines are too long
|
@ -1 +0,0 @@
|
||||||
[[1,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[1,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[1,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[1,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[1,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[1,1,21,4,4,4,4,4,4,4,4,4,4,4,4,4,4,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[1,1,1,1,1,1,8,5,5,5,5,5,5,5,5,5,5,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[1,1,1,1,1,8,20,0,0,41,0,41,0,41,0,0,41,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,17,17,17],[1,1,1,1,8,20,0,0,0,41,0,41,0,53,0,0,41,0,0,0,0,0,0,0,10,17,17,12,4,4,4,4,4,4,4,4,22,1,1,1],[1,1,1,8,20,0,0,0,0,54,0,41,0,0,0,0,41,0,0,0,0,6,4,4,22,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[1,1,1,3,0,0,0,0,0,0,0,41,0,0,0,0,41,0,0,0,0,19,5,9,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[1,1,1,3,0,0,0,0,0,0,0,49,50,50,50,50,51,0,0,0,0,0,0,19,9,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[1,1,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[1,1,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,49,50,50,50,50,50,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[1,1,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[1,1,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[1,1,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[1,1,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[1,1,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[1,1,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]]
|
|
|
@ -1 +0,0 @@
|
||||||
[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,162,163,163,163,164,0,0,0,0,0,0,0,0,0],[154,155,0,0,0,0,144,145,145,146,176,176,176,144,145,145,146,0,0,0,0,152,153],[175,182,177,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,175,169,177],[0,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,165,0],[0,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,165,0],[0,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,165,0],[0,181,0,162,164,0,0,0,0,0,0,0,0,0,0,0,0,0,162,164,0,178,0],[0,0,0,175,177,0,0,0,0,0,0,0,0,0,0,0,0,0,175,177,0,0,0],[0,0,0,0,0,0,144,145,145,145,145,145,145,145,145,145,146,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]
|
|
|
@ -1,30 +0,0 @@
|
||||||
LevelProperties = {
|
|
||||||
pos = {
|
|
||||||
x = 0,
|
|
||||||
y = 0
|
|
||||||
},
|
|
||||||
offset = {
|
|
||||||
x = 0,
|
|
||||||
y = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TileProperties = {
|
|
||||||
width = 16,
|
|
||||||
height = 16,
|
|
||||||
scale = game.scale,
|
|
||||||
tileset = love.graphics.newImage("assets/terrain/tileset.png")
|
|
||||||
}
|
|
||||||
|
|
||||||
TileCollisions = {
|
|
||||||
whole = { 001, 002, 003, 004, 005, 006, 007, 008, 009, 010, 011, 012, 013, 014, 015, 016, 018, 019, 020, 021, 022, 024, 025, 026, 027, 028, 029, 030, 031, 032, 033, 034, 035, 036, 037, 038, 039, 040, 041, 042, 043, 044, 045, 049, 050, 051, 052, 054, 055, 056, 057, 061, 062, 063, 064, 065, 066, 067, 068, 069, 85, 086, 087, 088, 089, 090, 091, 092, 093, 094, 095, 096, 097, 098, 099, 100, 101, 102, 103, 104, 105, 106, 107, 108,113, 114, 115, 116, 125, 126, 127, 128, 133, 134, 135, 136, 137, 138, 139, 140, 145, 146, 147, 148, 149, 150, 151, 152 },
|
|
||||||
platform = { 046, 047, 048, 058, 059, 060 },
|
|
||||||
ramp_topright_bot = { 109, 161, 117, 157 },
|
|
||||||
ramp_topright_top = { 110, 162, 118, 158 },
|
|
||||||
ramp_topleft_top = { 111, 163, 119, 159 },
|
|
||||||
ramp_topleft_bot = { 112, 164, 120, 160 },
|
|
||||||
ramp_botright_bot = { 073, 077, 081, 121 },
|
|
||||||
ramp_botright_top = { 074, 078, 082, 122 },
|
|
||||||
ramp_botleft_top = { 075, 079, 083, 123 },
|
|
||||||
ramp_botleft_bot = { 076, 080, 084, 124 }
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,162,163,163,163,164,0,0,0,0,0,0,0,0,0],[154,155,0,0,0,0,144,145,145,146,176,176,176,144,145,145,146,0,0,0,0,152,153],[175,182,177,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,175,169,177],[0,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,165,0],[0,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,165,0],[0,168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,165,0],[0,181,0,162,164,0,0,0,0,0,0,0,0,0,0,0,0,0,162,164,0,178,0],[0,0,0,175,177,0,0,0,0,0,0,0,0,0,0,0,0,0,175,177,0,0,0],[0,0,0,0,0,0,144,145,145,145,145,145,145,145,145,145,146,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]
|
|
|
@ -1 +0,0 @@
|
||||||
[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,5,5,5,5,5,5,5,5,5,5,5,9,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66],[68,68,68,68,68,68,68,68,6,4,4,31,32,0,0,0,0,0,55,0,0,0,0,0,0,0,0,2,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66],[66,66,66,66,66,66,66,66,66,66,66,66,30,31,32,0,0,0,0,0,0,0,0,0,0,0,0,2,66,66,66,66,66,66,66,66,66,66,66,66,66,8,5,5,5,5,5,5,5,5,5,5,5,5,9,66,66,66,66,66],[66,66,66,66,66,66,66,66,66,66,66,66,66,66,30,4,4,4,4,4,7,0,0,0,0,0,0,2,66,66,66,66,66,66,66,66,66,66,66,66,66,3,0,0,0,0,0,0,0,0,0,0,0,0,2,66,66,66,66,66],[66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,3,14,0,0,0,0,0,2,66,66,66,66,66,66,66,66,66,66,66,66,66,3,0,0,0,0,0,0,0,0,0,0,0,0,2,66,66,66,66,66],[66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,3,0,14,0,0,0,0,19,5,5,5,5,5,5,5,5,5,5,5,5,5,20,0,0,0,0,0,0,0,0,0,0,0,0,2,66,66,66,66,66],[66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,3,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,66,66,66,66,66],[66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,3,0,0,0,14,0,0,0,0,55,0,0,0,0,55,0,0,0,0,55,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,66,66,66,66,66],[66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,66,66,66,66,66],[66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,3,0,0,0,0,0,6,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,22,66,66,66,66,66],[66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,8,5,5,5,5,20,0,0,0,0,6,22,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66],[66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,3,0,0,0,0,0,0,0,0,6,22,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66],[66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,3,0,0,55,0,0,0,0,6,22,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66],[66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,3,0,0,0,0,0,0,6,22,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66],[66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,21,4,4,4,4,4,4,22,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66],[66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66]]
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
return {
|
||||||
|
name = "level1",
|
||||||
|
tileset = tileset.library,
|
||||||
|
tiles = {
|
||||||
|
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
|
||||||
|
{13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13},
|
||||||
|
{ },
|
||||||
|
{ 0, 0, 0, 0, 0, 0, 5,25,26, 6,25,26, 7, 0, 5,25,26, 7},
|
||||||
|
{ 0, 0, 0, 0, 0, 0, 5,37,38, 6,37,38, 7, 0, 5,37,38, 7},
|
||||||
|
{ 0, 0, 0, 0, 0, 0, 5,37,38, 6,37,38, 7, 0, 5,37,38, 7},
|
||||||
|
{ 0, 0, 0, 0, 0, 0, 5,49,50, 6,49,50, 7, 0, 5,49,50, 7},
|
||||||
|
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
|
||||||
|
{13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13},
|
||||||
|
},
|
||||||
|
objects = {}
|
||||||
|
}
|
|
@ -1 +0,0 @@
|
||||||
[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[202,202,202,202,202,202,202,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,202,0,202,202,202,202,202,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,202,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,202,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,202,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,202,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,202,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,202,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,202,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,202,202,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,106,106,106,106,106,106,106,106,109,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,119,119,119,119,119,119,119,119,130,109,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,119,119,119,119,119,119,119,119,119,130,109,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,119,119,119,119,119,119,119,119,119,119,130,109,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,119,119,119,119,119,119,119,119,119,119,119,130,106,106,106,106,106,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]
|
|
File diff suppressed because one or more lines are too long
|
@ -1 +0,0 @@
|
||||||
[[107,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,105],[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,118],[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,192,118],[122,167,182,1,2,3,4,5,6,7,8,9,10,11,12,13,208,205,121],[119,180,168,14,15,16,17,18,19,20,21,22,23,24,25,26,204,218,119],[119,180,168,27,28,29,30,31,32,33,34,35,36,37,38,39,204,218,119],[119,180,168,40,41,42,43,44,45,46,47,48,49,50,51,52,204,218,119],[119,180,168,53,54,55,56,57,58,59,60,61,62,63,64,65,204,218,119],[119,180,182,66,67,68,69,70,71,72,73,74,75,76,77,78,208,218,119],[119,180,168,79,80,81,82,83,84,85,86,87,88,89,90,91,204,218,119],[119,180,168,92,93,94,95,96,97,98,99,100,101,102,103,104,204,218,119],[119,180,168,105,106,107,108,109,110,111,112,113,114,115,116,117,204,218,119],[119,180,182,118,119,120,121,122,123,124,125,126,127,128,129,130,208,218,119],[119,180,168,131,132,133,134,135,136,137,138,139,140,141,142,143,204,218,119],[119,180,168,144,145,146,147,148,149,150,151,152,153,154,155,156,204,218,119],[119,180,168,157,158,159,160,161,162,163,164,165,166,167,168,169,204,218,119],[119,180,182,170,171,172,173,174,175,176,177,178,179,180,181,182,208,218,119],[119,180,168,183,184,185,186,187,188,189,190,191,192,193,194,195,204,218,119],[119,180,168,196,197,198,199,200,201,202,203,204,205,206,207,208,204,218,119],[119,180,168,209,210,211,212,213,214,215,216,217,218,219,220,221,204,218,119],[119,180,182,222,223,224,225,226,227,228,229,230,231,232,233,234,208,218,119],[119,180,168,235,236,237,238,239,240,241,242,243,244,245,246,247,204,218,119],[119,180,168,248,249,250,251,252,253,254,255,256,257,258,259,260,204,218,119],[119,180,168,261,262,263,264,265,266,267,268,269,270,271,272,273,204,218,119],[119,180,182,274,275,276,277,278,279,280,281,282,283,284,285,286,208,218,119],[119,180,168,287,288,289,290,291,292,293,294,295,296,297,298,299,204,218,119],[119,180,168,300,301,302,303,304,305,306,307,308,309,310,311,312,204,218,119],[119,120,181,0,0,0,0,0,0,0,0,0,0,0,0,0,217,118,119],[119,122,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,121,119],[119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119]]
|
|
|
@ -25,9 +25,24 @@ love.graphics.print("time: "..fps_total..", fps: "..fps_draw..", frametime: "..m
|
||||||
|
|
||||||
-- player isOnGroundCheck
|
-- player isOnGroundCheck
|
||||||
love.graphics.setColor(1,0,0)
|
love.graphics.setColor(1,0,0)
|
||||||
love.graphics.points(-Camera.pos.x + main_Player.pos.x, -Camera.pos.y + main_Player.pos.y)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function DebugColisions()
|
function DebugColisions()
|
||||||
objects.DrawCollisions()
|
objects.DrawCollisions()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function DebugEntities()
|
||||||
|
for _, enty in pairs(LoadedEntities) do
|
||||||
|
-- draw center GREEN
|
||||||
|
love.graphics.setColor(0,1,0)
|
||||||
|
love.graphics.circle("fill", -Camera.pos.x + enty.pos.x, -Camera.pos.y + enty.pos.y, 1)
|
||||||
|
-- draw collision box PURPLE
|
||||||
|
love.graphics.setColor(0,1,1)
|
||||||
|
love.graphics.points(
|
||||||
|
-Camera.pos.x + enty.pos.x + enty.boxCollision.from.x, -Camera.pos.y + enty.pos.y + enty.boxCollision.from.y,
|
||||||
|
-Camera.pos.x + enty.pos.x + enty.boxCollision.from.x, -Camera.pos.y + enty.pos.y + enty.boxCollision.to.y,
|
||||||
|
-Camera.pos.x + enty.pos.x + enty.boxCollision.to.x, -Camera.pos.y + enty.pos.y + enty.boxCollision.from.y,
|
||||||
|
-Camera.pos.x + enty.pos.x + enty.boxCollision.to.x, -Camera.pos.y + enty.pos.y + enty.boxCollision.to.y
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
|
@ -39,19 +39,33 @@ end
|
||||||
|
|
||||||
function Arrow:DoPhysics()
|
function Arrow:DoPhysics()
|
||||||
-- horizontal collisions
|
-- horizontal collisions
|
||||||
if not isThereAnyCollisionAt(self.pos.x + self.vel.x, self.pos.y) then
|
if not isThereAnyCollisionAt(
|
||||||
|
self.pos.x + self.vel.x,
|
||||||
|
self.pos.y
|
||||||
|
) then
|
||||||
self.pos.x = self.pos.x + self.vel.x
|
self.pos.x = self.pos.x + self.vel.x
|
||||||
else
|
else
|
||||||
while not isThereCollisionAt(self.pos.x + math.sign(self.vel.x), self.pos.y) do
|
while not isThereObjectAt(
|
||||||
|
self.pos.x + math.sign(self.vel.x),
|
||||||
|
self.pos.y,
|
||||||
|
objects.collisions
|
||||||
|
) do
|
||||||
self.pos.x = self.pos.x + math.sign(self.vel.x)
|
self.pos.x = self.pos.x + math.sign(self.vel.x)
|
||||||
end
|
end
|
||||||
self.stuck = true
|
self.stuck = true
|
||||||
end
|
end
|
||||||
-- vertical collision
|
-- vertical collision
|
||||||
if not isThereAnyCollisionAt(self.pos.x, self.pos.y + self.vel.y) then
|
if not isThereAnyCollisionAt(
|
||||||
|
self.pos.x,
|
||||||
|
self.pos.y + self.vel.y
|
||||||
|
) then
|
||||||
self.pos.y = self.pos.y + self.vel.y
|
self.pos.y = self.pos.y + self.vel.y
|
||||||
else
|
else
|
||||||
while not isThereCollisionAt(self.pos.x, self.pos.y + math.sign(self.vel.y)) do
|
while not isThereObjectAt(
|
||||||
|
self.pos.x,
|
||||||
|
self.pos.y + math.sign(self.vel.y),
|
||||||
|
objects.collisions
|
||||||
|
) do
|
||||||
self.pos.y = self.pos.y + math.sign(self.vel.y)
|
self.pos.y = self.pos.y + math.sign(self.vel.y)
|
||||||
end
|
end
|
||||||
self.stuck = true
|
self.stuck = true
|
||||||
|
|
|
@ -7,22 +7,14 @@
|
||||||
Player.coins = 0
|
Player.coins = 0
|
||||||
|
|
||||||
-- physics
|
-- physics
|
||||||
o.vel = {
|
o.moveSpeed = 1.5
|
||||||
x = 0,
|
|
||||||
y = 0
|
o.boxCollision = {
|
||||||
|
from = {x = -8, y = -16},
|
||||||
|
to = {x = 8, y = 0}
|
||||||
}
|
}
|
||||||
|
|
||||||
-- constants
|
o.lightRange = 32
|
||||||
o.acc = 45
|
|
||||||
o.friction = 20
|
|
||||||
o.gravity = 9.81
|
|
||||||
o.climbHeight = 4
|
|
||||||
o.jumpForce = 5
|
|
||||||
o.maxSpeed = 600
|
|
||||||
o.jumpMaxSpeed = 9.5
|
|
||||||
o.zeroSpeed = 0.001
|
|
||||||
o.lightRange = 20
|
|
||||||
|
|
||||||
-- status
|
-- status
|
||||||
o.isJumping = false
|
o.isJumping = false
|
||||||
o.isOnGround = 0
|
o.isOnGround = 0
|
||||||
|
@ -31,14 +23,16 @@
|
||||||
o.canJump = true
|
o.canJump = true
|
||||||
o.canFall = true
|
o.canFall = true
|
||||||
o.canFriction = true
|
o.canFriction = true
|
||||||
o.mask_type = animation.moth_mask
|
o.maskType = animation.moth_mask
|
||||||
|
|
||||||
-- sprite
|
-- sprite
|
||||||
o.sprite_offset = {x = 8, y = 16}
|
o.sprite_offset = {x = 8, y = 16}
|
||||||
o.target_offset = {x = 0, y = 12}
|
o.target_offset = {x = 0, y = 12}
|
||||||
o.body = Animation:New(animation.nancy.idle)
|
o.body = Animation:New(animation.nancy.idle)
|
||||||
o.mask = Animation:New(animation.moth_mask.idle)
|
o.mask = Animation:New(animation.moth_mask.idle)
|
||||||
-- lights
|
|
||||||
|
|
||||||
|
-- lights
|
||||||
|
o.light = CreateLight(o.pos.x,o.pos.y,o.lightRange)
|
||||||
|
|
||||||
setmetatable(o, self)
|
setmetatable(o, self)
|
||||||
self.__index = self
|
self.__index = self
|
||||||
|
@ -47,64 +41,39 @@
|
||||||
end
|
end
|
||||||
|
|
||||||
function Player:Smart()
|
function Player:Smart()
|
||||||
-- PLATFORMER INPUT
|
if love.keyboard.isDown("a") then self.vel.x = -self.moveSpeed
|
||||||
if self.isOnGround > 0 then
|
elseif love.keyboard.isDown("d") then self.vel.x = self.moveSpeed
|
||||||
-- apply friction
|
else self.vel.x = 0 end
|
||||||
|
if love.keyboard.isDown("w") then self.vel.y = -self.moveSpeed
|
||||||
-- horizontal input (slide~~)
|
elseif love.keyboard.isDown("s") then self.vel.y = self.moveSpeed
|
||||||
if love.keyboard.isDown('a',"left") then
|
else self.vel.y = 0 end
|
||||||
self.vel.x = self.vel.x - self.acc*current_dt
|
|
||||||
end
|
|
||||||
if love.keyboard.isDown('d',"right") then
|
|
||||||
self.vel.x = self.vel.x + self.acc*current_dt
|
|
||||||
end
|
|
||||||
if self.canJump then
|
|
||||||
-- vertical input (jump!)
|
|
||||||
if love.keyboard.isDown("up", "w") and self.isJumping ~= true then
|
|
||||||
self.vel.y = self.vel.y - self.jumpForce
|
|
||||||
self.isOnGround = 0
|
|
||||||
self.isJumping = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- fall if down input on platforms
|
function Player:DoPhysics()
|
||||||
if not isThereCollisionAt(
|
self.pos.x = self.pos.x + self.vel.x
|
||||||
self.pos.x,
|
self.pos.y = self.pos.y + self.vel.y
|
||||||
self.pos.y + self.vel.y
|
|
||||||
) and not isThereLadderAt(
|
|
||||||
self.pos.x,
|
|
||||||
self.pos.y + self.vel.y
|
|
||||||
) and isTherePlatformAt(
|
|
||||||
self.pos.x,
|
|
||||||
self.pos.y + self.vel.y
|
|
||||||
) and love.keyboard.isDown("down", "s")
|
|
||||||
then
|
|
||||||
self.pos.y = self.pos.y + tileProperties.height/3
|
|
||||||
self.isOnGround = 0
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Player:HandleAnimation()
|
function Player:HandleAnimation()
|
||||||
|
self.light.pos.x = self.pos.x-self.target_offset.x
|
||||||
|
self.light.pos.y = self.pos.y-self.target_offset.y
|
||||||
|
|
||||||
-- flip sprite to look in the direction is moving
|
-- flip sprite to look in the direction is moving
|
||||||
if self.vel.x ~= 0 then self.sprite_flip.x = math.sign(self.vel.x) end
|
if self.vel.x ~= 0 then self.sprite_flip.x = math.sign(self.vel.x) end
|
||||||
|
|
||||||
-- animation manager
|
-- animation priority
|
||||||
if self.isOnLadder then
|
if self.vel.y > 1.25 then
|
||||||
self.body = self.body:ChangeTo(animation.nancy.jump)
|
|
||||||
self.mask = self.mask:ChangeTo(self.mask_type.jump)
|
|
||||||
elseif self.isOnGround == 0 and self.isJumping and self.vel.y > 1.25 then
|
|
||||||
self.body = self.body:ChangeTo(animation.nancy.fall)
|
self.body = self.body:ChangeTo(animation.nancy.fall)
|
||||||
self.mask = self.mask:ChangeTo(self.mask_type.fall)
|
self.mask = self.mask:ChangeTo(self.maskType.fall)
|
||||||
elseif self.isOnGround == 0 and self.vel.y < 0 then
|
elseif self.vel.y < 0 then
|
||||||
self.body = self.body:ChangeTo(animation.nancy.jump)
|
self.body = self.body:ChangeTo(animation.nancy.jump)
|
||||||
self.mask = self.mask:ChangeTo(self.mask_type.jump)
|
self.mask = self.mask:ChangeTo(self.maskType.jump)
|
||||||
elseif self.vel.x ~= 0 then
|
elseif self.vel.x ~= 0 then
|
||||||
self.body = self.body:ChangeTo(animation.nancy.run)
|
self.body = self.body:ChangeTo(animation.nancy.run)
|
||||||
self.mask = self.mask:ChangeTo(self.mask_type.run)
|
self.mask = self.mask:ChangeTo(self.maskType.run)
|
||||||
else
|
else
|
||||||
self.body = self.body:ChangeTo(animation.nancy.idle)
|
self.body = self.body:ChangeTo(animation.nancy.idle)
|
||||||
self.mask = self.mask:ChangeTo(self.mask_type.idle)
|
self.mask = self.mask:ChangeTo(self.maskType.idle)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- special case: idle animation gets slower by time
|
-- special case: idle animation gets slower by time
|
||||||
|
@ -114,124 +83,17 @@ function Player:HandleAnimation()
|
||||||
|
|
||||||
self.body:Animate()
|
self.body:Animate()
|
||||||
self.body:Draw(
|
self.body:Draw(
|
||||||
self.pos.x - Camera.pos.x - ( (self.sprite_offset.x) * math.cos(self.sprite_rotation) - (self.sprite_offset.y) * math.sin(self.sprite_rotation)) * self.sprite_scale.x * self.sprite_flip.x,
|
math.floor(self.pos.x) - Camera.pos.x - ( (self.sprite_offset.x) * math.cos(self.sprite_rotation) - (self.sprite_offset.y) * math.sin(self.sprite_rotation)) * self.sprite_scale.x * self.sprite_flip.x,
|
||||||
self.pos.y - Camera.pos.y - ( (self.sprite_offset.x) * math.sin(self.sprite_rotation) + (self.sprite_offset.y) * math.cos(self.sprite_rotation)) * self.sprite_scale.y * self.sprite_flip.y,
|
math.floor(self.pos.y)- Camera.pos.y - ( (self.sprite_offset.x) * math.sin(self.sprite_rotation) + (self.sprite_offset.y) * math.cos(self.sprite_rotation)) * self.sprite_scale.y * self.sprite_flip.y,
|
||||||
self.sprite_rotation,
|
self.sprite_rotation,
|
||||||
self.sprite_scale.x * self.sprite_flip.x,
|
self.sprite_scale.x * self.sprite_flip.x,
|
||||||
self.sprite_scale.y * self.sprite_flip.y
|
self.sprite_scale.y * self.sprite_flip.y
|
||||||
)
|
)
|
||||||
self.mask:Draw(
|
self.mask:Draw(
|
||||||
self.pos.x - Camera.pos.x - ( (self.sprite_offset.x) * math.cos(self.sprite_rotation) - (self.sprite_offset.y) * math.sin(self.sprite_rotation)) * self.sprite_scale.x * self.sprite_flip.x,
|
math.floor(self.pos.x) - Camera.pos.x - ( (self.sprite_offset.x) * math.cos(self.sprite_rotation) - (self.sprite_offset.y) * math.sin(self.sprite_rotation)) * self.sprite_scale.x * self.sprite_flip.x,
|
||||||
self.pos.y - Camera.pos.y - ( (self.sprite_offset.x) * math.sin(self.sprite_rotation) + (self.sprite_offset.y) * math.cos(self.sprite_rotation)) * self.sprite_scale.y * self.sprite_flip.y,
|
math.floor(self.pos.y)- Camera.pos.y - ( (self.sprite_offset.x) * math.sin(self.sprite_rotation) + (self.sprite_offset.y) * math.cos(self.sprite_rotation)) * self.sprite_scale.y * self.sprite_flip.y,
|
||||||
self.sprite_rotation,
|
self.sprite_rotation,
|
||||||
self.sprite_scale.x * self.sprite_flip.x,
|
self.sprite_scale.x * self.sprite_flip.x,
|
||||||
self.sprite_scale.y * self.sprite_flip.y
|
self.sprite_scale.y * self.sprite_flip.y
|
||||||
)
|
)
|
||||||
|
|
||||||
--[[
|
|
||||||
love.graphics.print(self.body.frame .. "/".. self.body.frames.." - "..self.body.subframe.."/"..self.body.speed.." ("..current_dt..")")
|
|
||||||
love.graphics.print(animation.nancy.idle.path,0,20)
|
|
||||||
love.graphics.print(self.body.path,0,30)
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
|
||||||
function Player:DoPhysics()
|
|
||||||
-- reset physics resolution
|
|
||||||
self.canFall = true
|
|
||||||
self.canJump = true
|
|
||||||
self.canFriction = true
|
|
||||||
-- reset flags
|
|
||||||
self.isOnLadder = false
|
|
||||||
-- truncate to max & min values
|
|
||||||
if math.abs(self.vel.x) > self.maxSpeed then
|
|
||||||
self.vel.x = self.maxSpeed * math.sign(self.vel.x)
|
|
||||||
end
|
|
||||||
if math.abs(self.vel.y) > self.maxSpeed then
|
|
||||||
self.vel.y = self.maxSpeed * math.sign(self.vel.y)
|
|
||||||
end
|
|
||||||
if math.abs(self.vel.x) < self.zeroSpeed then
|
|
||||||
self.vel.x = 0
|
|
||||||
end
|
|
||||||
if math.abs(self.vel.y) < self.zeroSpeed then
|
|
||||||
self.vel.y = 0
|
|
||||||
end
|
|
||||||
|
|
||||||
-- if on air, say so!
|
|
||||||
if self.vel.y > 5 then
|
|
||||||
self.isJumping = true
|
|
||||||
end
|
|
||||||
|
|
||||||
-- if its on ground, then say so.
|
|
||||||
if self.vel.y > 0 then
|
|
||||||
if isThereAnyCollisionAt(
|
|
||||||
self.pos.x,
|
|
||||||
self.pos.y + self.vel.y
|
|
||||||
) then
|
|
||||||
self.isOnGround = self.coyoteValue
|
|
||||||
self.isJumping = false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- horizontal collisions
|
|
||||||
if isThereAnyCollisionAt(self.pos.x + self.vel.x, self.pos.y) then
|
|
||||||
-- checks for ladders
|
|
||||||
if isThereLadderAt(self.pos.x + self.vel.x, self.pos.y)
|
|
||||||
and self.vel.x ~= 0
|
|
||||||
and not isThereLadderAt(self.pos.x, self.pos.y)
|
|
||||||
then
|
|
||||||
self.vel.y = 0
|
|
||||||
self.vel.x = 0
|
|
||||||
|
|
||||||
self.pos.y = self.pos.y - 4 * current_dt
|
|
||||||
|
|
||||||
self.canFall = false
|
|
||||||
self.canJump = false
|
|
||||||
self.canFriction = false
|
|
||||||
|
|
||||||
self.isOnLadder = true
|
|
||||||
self.isOnGround = self.coyoteValue
|
|
||||||
end
|
|
||||||
|
|
||||||
-- checks for slopes
|
|
||||||
for i = 1, self.climbHeight do
|
|
||||||
if not isThereCollisionAt(self.pos.x + self.vel.x, self.pos.y - i)
|
|
||||||
and self.isOnGround > 0 then
|
|
||||||
|
|
||||||
self.pos.x = self.pos.x + self.vel.x * 4/5
|
|
||||||
self.pos.y = self.pos.y - i
|
|
||||||
|
|
||||||
self.canFriction = false
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- hey, you arent permanently stopped while collisioning, just lose a bit of force!
|
|
||||||
if self.canFriction then
|
|
||||||
self.vel.x = self.vel.x * (1 - math.min(current_dt * self.friction/15, 1))
|
|
||||||
end
|
|
||||||
else
|
|
||||||
self.pos.x = self.pos.x + self.vel.x
|
|
||||||
end
|
|
||||||
|
|
||||||
-- vertical collision
|
|
||||||
if self.vel.y > 0
|
|
||||||
and isThereAnyCollisionAt(self.pos.x, self.pos.y + self.vel.y) then
|
|
||||||
self.isOnGround = self.coyoteValue
|
|
||||||
self.isJumping = false
|
|
||||||
self.vel.y = 0
|
|
||||||
else
|
|
||||||
self.pos.y = self.pos.y + self.vel.y
|
|
||||||
self.isOnGround = math.max(self.isOnGround - 1, 0)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- drop.
|
|
||||||
if self.canFall then
|
|
||||||
self.vel.y = self.vel.y + 2*self.gravity * current_dt
|
|
||||||
end
|
|
||||||
|
|
||||||
-- friction hard in ground, soft in air
|
|
||||||
if self.isOnGround > 0 then
|
|
||||||
self.vel.x = self.vel.x * (1 - math.min(current_dt * self.friction, 1))
|
|
||||||
else
|
|
||||||
self.vel.x = self.vel.x * (1 - math.min(current_dt * self.friction/20, 1))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,6 +5,12 @@ function Entity:New(x,y)
|
||||||
o = {}
|
o = {}
|
||||||
o.pos = {x = x, y = y}
|
o.pos = {x = x, y = y}
|
||||||
o.vel = {x = 0, y = 0}
|
o.vel = {x = 0, y = 0}
|
||||||
|
|
||||||
|
o.boxCollision = {
|
||||||
|
from = {x = x, y = y},
|
||||||
|
to = {x = x, y = y}
|
||||||
|
}
|
||||||
|
|
||||||
o.class = "Entity"
|
o.class = "Entity"
|
||||||
|
|
||||||
o.sprite_offset = {x = 0, y = 0}
|
o.sprite_offset = {x = 0, y = 0}
|
||||||
|
@ -12,13 +18,44 @@ function Entity:New(x,y)
|
||||||
o.sprite_rotation = math.rad(0)
|
o.sprite_rotation = math.rad(0)
|
||||||
o.sprite_flip = { x = 1, y = 1}
|
o.sprite_flip = { x = 1, y = 1}
|
||||||
o.illuminated = false
|
o.illuminated = false
|
||||||
|
|
||||||
setmetatable(o, self)
|
setmetatable(o, self)
|
||||||
self.__index = self
|
self.__index = self
|
||||||
return o
|
return o
|
||||||
end
|
end
|
||||||
|
|
||||||
function Entity:Move(target, speed) -- target = {tx int, ty int} / speed = int
|
-- returns true if theres a collision at that point. also marks collisioned tile as collision true
|
||||||
|
function Entity:isCollidingAt(x,y,object)
|
||||||
|
local result = false
|
||||||
|
for _, col in pairs(object) do
|
||||||
|
result = self.pos.x + self.boxCollision.from.x < col.to.x
|
||||||
|
and self.pos.x + self.boxCollision.to.x > col.from.x
|
||||||
|
and self.pos.y + self.boxCollision.from.y < col.to.y
|
||||||
|
and self.pos.y + self.boxCollision.to.y > col.from.y
|
||||||
|
if result == true then break end
|
||||||
|
end
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
function Entity:isCollidingWith(entity)
|
||||||
|
return self.pos.x + self.boxCollision.from.x < entity.pos.x + entity.boxCollision.to.x
|
||||||
|
and self.pos.x + self.boxCollision.to.x > entity.pos.x + entity.boxCollision.from.x
|
||||||
|
and self.pos.y + self.boxCollision.from.y < entity.pos.y + entity.boxCollision.to.y
|
||||||
|
and self.pos.y + self.boxCollision.to.y > entity.pos.y + entity.boxCollision.from.y
|
||||||
|
end
|
||||||
|
|
||||||
|
function Entity:isCollidingAtAll(x,y)
|
||||||
|
local result = false
|
||||||
|
if not result then
|
||||||
|
result = self:isCollidingAt(x,y,objects.collisions)
|
||||||
|
end
|
||||||
|
if not result then
|
||||||
|
result = self:isCollidingAt(x,y,objects.ladders)
|
||||||
|
end
|
||||||
|
if not result then
|
||||||
|
result = self:isCollidingAt(x,y,objects.platforms)
|
||||||
|
end
|
||||||
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[function Entity:Draw()
|
--[[function Entity:Draw()
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
-- animations
|
-- animationsç
|
||||||
|
-- all these are linear animations, maybe in the future make proper animations?
|
||||||
animation = {
|
animation = {
|
||||||
kupo = {
|
kupo = {
|
||||||
body = {
|
body = {
|
||||||
|
@ -63,6 +64,9 @@ animation = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- animation loader
|
||||||
|
-- im unsure if this is too memory expensive (probably)
|
||||||
|
-- this should go elsewhere, maybe
|
||||||
for _, object in pairs(animation) do
|
for _, object in pairs(animation) do
|
||||||
for _, anim in pairs(object) do
|
for _, anim in pairs(object) do
|
||||||
anim.imgs = {}
|
anim.imgs = {}
|
||||||
|
@ -77,15 +81,21 @@ levelProperties = {
|
||||||
x = 0,
|
x = 0,
|
||||||
y = 0
|
y = 0
|
||||||
},
|
},
|
||||||
|
-- im unsure why there's offset at all, here
|
||||||
offset = {
|
offset = {
|
||||||
x = 0,
|
x = 0,
|
||||||
y = 0
|
y = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tileset = {
|
||||||
|
bricks = love.graphics.newImage("assets/tileset/bricks.png"),
|
||||||
|
books = love.graphics.newImage("assets/tileset/bricks.png"),
|
||||||
|
library = love.graphics.newImage("assets/tileset/library.png")
|
||||||
|
}
|
||||||
|
|
||||||
tileProperties = {
|
tileProperties = {
|
||||||
width = 16,
|
width = 16,
|
||||||
height = 16,
|
height = 16,
|
||||||
scale = 1,
|
scale = 1,
|
||||||
tileset = love.graphics.newImage("assets/terrain/tileset.png")
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,22 @@
|
||||||
function LevelLoadTiles()
|
function LevelLoadTiles()
|
||||||
LevelInfo = {}
|
|
||||||
Tiles = dofile("Mothback/data/tiles.lua")
|
|
||||||
--[[
|
--[[
|
||||||
on level format:
|
on level format:
|
||||||
|
|
||||||
id = tile identifier
|
id = tile identifier
|
||||||
depth = order in the render
|
depth = order in the render
|
||||||
force = rendering other tile instead of the one in this position
|
force = rendering other tile instead of the one in this position
|
||||||
overlay = render another tile id
|
overlay = render another tile id or, if multiple tiles {id, id, id,} or
|
||||||
overlay_depth = foreground/background overlay depth
|
overlay_depth = foreground/background overlay depth
|
||||||
type = collision type
|
type = collision type
|
||||||
|
|
||||||
|
|
||||||
]]
|
]]
|
||||||
LevelTiles = json.decode(getInput("Mothback/data/levels/"..currLevel..".json"))
|
|
||||||
LevelInfo.Width = LevelGetWidth()
|
LevelData = dofile("Mothback/data/levels/"..currLevel..".lua")
|
||||||
LevelInfo.Height = LevelGetHeight()
|
Tiles = dofile("Mothback/data/tileset/library.lua")
|
||||||
|
LevelTiles = LevelData.tiles
|
||||||
|
LevelData.Width = LevelGetWidth()
|
||||||
|
LevelData.Height = LevelGetHeight()
|
||||||
LevelIndexTiles()
|
LevelIndexTiles()
|
||||||
TileCreateObjects()
|
TileCreateObjects()
|
||||||
end
|
end
|
||||||
|
@ -35,8 +37,8 @@ function LevelIndexTiles()
|
||||||
TileIndex = {}
|
TileIndex = {}
|
||||||
|
|
||||||
-- number of tiles in tileset!
|
-- number of tiles in tileset!
|
||||||
local width = tileProperties.tileset:getPixelWidth()/tileProperties.width
|
local width = LevelData.tileset:getPixelWidth()/tileProperties.width
|
||||||
local height = tileProperties.tileset:getPixelHeight()/tileProperties.height
|
local height = LevelData.tileset:getPixelHeight()/tileProperties.height
|
||||||
for i = 0, height do
|
for i = 0, height do
|
||||||
for j = 0, width do
|
for j = 0, width do
|
||||||
TileIndex[i*width+j+1] = love.graphics.newQuad(
|
TileIndex[i*width+j+1] = love.graphics.newQuad(
|
||||||
|
@ -44,12 +46,12 @@ function LevelIndexTiles()
|
||||||
i*tileProperties.height,
|
i*tileProperties.height,
|
||||||
tileProperties.width,
|
tileProperties.width,
|
||||||
tileProperties.height,
|
tileProperties.height,
|
||||||
tileProperties.tileset:getDimensions()
|
LevelData.tileset:getDimensions()
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- init animated tile properties
|
||||||
for _, properties in pairs(Tiles) do
|
for _, properties in pairs(Tiles) do
|
||||||
if properties.animation ~= nil then
|
if properties.animation ~= nil then
|
||||||
properties.tileset = love.graphics.newImage("assets/terrain/"..properties.animation..".png")
|
properties.tileset = love.graphics.newImage("assets/terrain/"..properties.animation..".png")
|
||||||
|
@ -75,18 +77,44 @@ function LevelIndexTiles()
|
||||||
image_count = image_count + 1
|
image_count = image_count + 1
|
||||||
|
|
||||||
table.insert(properties.imgs,quad)
|
table.insert(properties.imgs,quad)
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
properties.image_count = image_count
|
properties.image_count = image_count
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- instance level tiles according to the properties
|
||||||
|
for i = 1, #LevelTiles do
|
||||||
|
for j = 1, #LevelTiles[i] do
|
||||||
|
local id = LevelTiles[i][j]
|
||||||
|
LevelTiles[i][j] = {}
|
||||||
|
local tile = LevelTiles[i][j]
|
||||||
|
tile.id = id
|
||||||
|
|
||||||
|
for _, properties in pairs(Tiles) do
|
||||||
|
if properties.id == tile.id then
|
||||||
|
if type(properties.overlay) == "table" then
|
||||||
|
tile.display_overlay = properties.overlay[math.random(#properties.overlay)]
|
||||||
|
else
|
||||||
|
tile.display_overlay = properties.overlay
|
||||||
|
end
|
||||||
|
|
||||||
|
if type(properties.force) == "table" then
|
||||||
|
tile.display = properties.force[math.random(#properties.force)]
|
||||||
|
else
|
||||||
|
tile.display = properties.force
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function LevelDisplayForeground()
|
function LevelDisplayForeground()
|
||||||
for i = 1, #LevelTiles do
|
for i = 1, #LevelTiles do
|
||||||
for j = 1, #LevelTiles[i] do
|
for j = 1, #LevelTiles[i] do
|
||||||
if LevelTiles[i][j] ~= 0 then
|
if LevelTiles[i][j].id ~= 0 then
|
||||||
|
|
||||||
local depth = TileGetDepth(LevelTiles[i][j])
|
local depth = TileGetDepth(LevelTiles[i][j])
|
||||||
DrawTile(
|
DrawTile(
|
||||||
|
@ -102,9 +130,10 @@ function LevelDisplayForeground()
|
||||||
end
|
end
|
||||||
|
|
||||||
function LevelDisplayBackground()
|
function LevelDisplayBackground()
|
||||||
|
love.graphics.setColor(0.7,0.7,0.7)
|
||||||
for i = 1, #LevelTiles do
|
for i = 1, #LevelTiles do
|
||||||
for j = 1, #LevelTiles[i] do
|
for j = 1, #LevelTiles[i] do
|
||||||
if LevelTiles[i][j] ~= 0 then
|
if LevelTiles[i][j].id ~= 0 then
|
||||||
|
|
||||||
local depth = TileGetDepth(LevelTiles[i][j])
|
local depth = TileGetDepth(LevelTiles[i][j])
|
||||||
DrawTile(
|
DrawTile(
|
||||||
|
@ -117,28 +146,28 @@ function LevelDisplayBackground()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
love.graphics.setColor(1,1,1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function TileGetType(tile)
|
||||||
function TileGetType(tile_id)
|
|
||||||
for _, properties in ipairs(Tiles) do
|
for _, properties in ipairs(Tiles) do
|
||||||
if properties.id == tile_id then
|
if properties.id == tile.id then
|
||||||
return properties.type
|
return properties.type
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function TileGetDepth(tile_id)
|
function TileGetDepth(tile)
|
||||||
for _, properties in ipairs(Tiles) do
|
for _, properties in ipairs(Tiles) do
|
||||||
if properties.id == tile_id then
|
if properties.id == tile.id then
|
||||||
return properties.depth
|
return properties.depth
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function TileGetLight(tile_id)
|
function TileGetLight(tile)
|
||||||
for _, properties in ipairs(Tiles) do
|
for _, properties in ipairs(Tiles) do
|
||||||
if properties.id == tile_id then
|
if properties.id == tile.id then
|
||||||
return properties.light
|
return properties.light
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -165,7 +194,7 @@ function TileCreateObjects()
|
||||||
|
|
||||||
for i = 1, #LevelTiles do
|
for i = 1, #LevelTiles do
|
||||||
for j = 1, #LevelTiles[i] do
|
for j = 1, #LevelTiles[i] do
|
||||||
if LevelTiles[i][j] ~= 0 then
|
if LevelTiles[i][j].id ~= 0 then
|
||||||
|
|
||||||
local type = TileGetType(LevelTiles[i][j])
|
local type = TileGetType(LevelTiles[i][j])
|
||||||
local light = TileGetLight(LevelTiles[i][j])
|
local light = TileGetLight(LevelTiles[i][j])
|
||||||
|
@ -471,9 +500,10 @@ function AnimateTiles()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function DrawTile(tile_id,x,y,depth)
|
function DrawTile(tile,x,y,depth)
|
||||||
for _, properties in pairs(Tiles) do
|
for _, properties in pairs(Tiles) do
|
||||||
if tile_id == properties.id then
|
if tile.id == properties.id then
|
||||||
|
|
||||||
if properties.animation ~= nil then
|
if properties.animation ~= nil then
|
||||||
if properties.imgs[properties.current_image] ~= nil
|
if properties.imgs[properties.current_image] ~= nil
|
||||||
and properties.depth == depth
|
and properties.depth == depth
|
||||||
|
@ -488,18 +518,20 @@ function DrawTile(tile_id,x,y,depth)
|
||||||
) end
|
) end
|
||||||
elseif properties.depth == depth then
|
elseif properties.depth == depth then
|
||||||
if properties.force ~= nil then
|
if properties.force ~= nil then
|
||||||
|
if properties.force ~= 0 then
|
||||||
love.graphics.draw(
|
love.graphics.draw(
|
||||||
tileProperties.tileset,
|
LevelData.tileset,
|
||||||
TileIndex[properties.force],
|
TileIndex[tile.display],
|
||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
0,
|
0,
|
||||||
tileProperties.scale,
|
tileProperties.scale,
|
||||||
tileProperties.scale
|
tileProperties.scale
|
||||||
)
|
)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
love.graphics.draw(
|
love.graphics.draw(
|
||||||
tileProperties.tileset,
|
LevelData.tileset,
|
||||||
TileIndex[properties.id],
|
TileIndex[properties.id],
|
||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
|
@ -528,8 +560,8 @@ function DrawTile(tile_id,x,y,depth)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
love.graphics.draw(
|
love.graphics.draw(
|
||||||
tileProperties.tileset,
|
LevelData.tileset,
|
||||||
TileIndex[properties.overlay],
|
TileIndex[tile.display_overlay],
|
||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
0,
|
0,
|
||||||
|
@ -539,6 +571,11 @@ function DrawTile(tile_id,x,y,depth)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
--[[
|
||||||
|
love.graphics.setColor(0,0,1)
|
||||||
|
love.graphics.print(tostring(tile.display),x+16,y)
|
||||||
|
love.graphics.setColor(1,1,1)
|
||||||
|
]]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,15 +5,19 @@ function CreateDarkness()
|
||||||
return love.graphics.newCanvas(game.width, game.height)
|
return love.graphics.newCanvas(game.width, game.height)
|
||||||
end
|
end
|
||||||
|
|
||||||
function CreateLight(x,y,range)
|
function CreateLight(x,y,range,lum,flicker)
|
||||||
local o = {}
|
local o = {}
|
||||||
o.pos = {
|
o.pos = {
|
||||||
x = x,
|
x = x,
|
||||||
y = y
|
y = y
|
||||||
}
|
}
|
||||||
o.range = range
|
o.range = range
|
||||||
|
o.lum = lum or 1
|
||||||
|
o.flicker_value = flicker or 1
|
||||||
o.flicker = 0
|
o.flicker = 0
|
||||||
o.dim = 0
|
o.dim = 0
|
||||||
|
o.flicker_speed = flicker_speed or 10
|
||||||
|
o.flicker_time = 0
|
||||||
table.insert(Lights,o)
|
table.insert(Lights,o)
|
||||||
return o
|
return o
|
||||||
end
|
end
|
||||||
|
@ -23,54 +27,46 @@ function SetDarkness()
|
||||||
love.graphics.rectangle("fill",0,0,game.width,game.height)
|
love.graphics.rectangle("fill",0,0,game.width,game.height)
|
||||||
end
|
end
|
||||||
|
|
||||||
function DoDarkness()
|
|
||||||
love.graphics.setColor(0,0,0,1)
|
|
||||||
love.graphics.rectangle("fill",0,0,game.width,game.height)
|
|
||||||
end
|
|
||||||
|
|
||||||
function DoLights()
|
function DoLights()
|
||||||
LightTimer = LightTimer + 1
|
|
||||||
|
|
||||||
if LightTimer >= 3 then
|
|
||||||
LightTimer = LightTimer - 3
|
|
||||||
for _, light in pairs(Lights) do
|
for _, light in pairs(Lights) do
|
||||||
light.flicker = math.random(-1,1)
|
light.flicker_time = light.flicker_time + 1
|
||||||
light.dim = (light.range+light.flicker)/2
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
love.graphics.setBlendMode("replace")
|
if light.flicker_time >= light.flicker_speed then
|
||||||
|
light.flicker_time = light.flicker_time - light.flicker_speed
|
||||||
|
light.flicker = 0 + math.random(-1,1)
|
||||||
|
light.flicker = math.min(math.max(light.flicker, -light.flicker_value),light.flicker_value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
--[[
|
||||||
-- first, border
|
-- first, border
|
||||||
love.graphics.setColor(1,1,1)
|
love.graphics.setColor(1,1,1)
|
||||||
for _, light in pairs(Lights) do
|
for _, light in pairs(Lights) do
|
||||||
|
|
||||||
--[[love.graphics.circle(
|
love.graphics.circle(
|
||||||
"fill",
|
"fill",
|
||||||
light.pos.x - Camera.pos.x,
|
light.pos.x - Camera.pos.x,
|
||||||
light.pos.y - Camera.pos.y,
|
light.pos.y - Camera.pos.y,
|
||||||
light.range + light.flicker + 1
|
light.range + light.flicker + 1
|
||||||
)]]
|
)
|
||||||
end
|
end
|
||||||
|
]]
|
||||||
|
love.graphics.setBlendMode("replace")
|
||||||
for _, enty in pairs(LoadedEntities) do
|
for _, enty in pairs(LoadedEntities) do
|
||||||
end
|
end
|
||||||
love.graphics.setColor(0,0,0,0.5)
|
|
||||||
|
local shades = 200
|
||||||
|
for i=1, shades do
|
||||||
for _, light in pairs(Lights) do
|
for _, light in pairs(Lights) do
|
||||||
|
local luminosity = shades*light.lum/100
|
||||||
|
love.graphics.setColor(0,0,0,math.min(1,math.max(0,(shades-i-luminosity+1)/(shades-luminosity+1))))
|
||||||
love.graphics.circle(
|
love.graphics.circle(
|
||||||
"fill",
|
"fill",
|
||||||
light.pos.x - Camera.pos.x,
|
light.pos.x - Camera.pos.x,
|
||||||
light.pos.y - Camera.pos.y,
|
light.pos.y - Camera.pos.y,
|
||||||
light.range + light.flicker
|
(light.range + light.flicker)*(shades-i+1)/shades
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
-- then, light
|
|
||||||
love.graphics.setColor(0,0,0,0)
|
|
||||||
for _, light in pairs(Lights) do
|
|
||||||
love.graphics.circle(
|
|
||||||
"fill",
|
|
||||||
light.pos.x - Camera.pos.x,
|
|
||||||
light.pos.y - Camera.pos.y,
|
|
||||||
light.range + light.flicker - light.dim
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
love.graphics.setBlendMode("alpha")
|
love.graphics.setBlendMode("alpha")
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,7 +6,6 @@ objects = {
|
||||||
ladders = {}
|
ladders = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
-- level functions
|
-- level functions
|
||||||
function objects.DrawCollisions()
|
function objects.DrawCollisions()
|
||||||
for _, col in pairs(objects.collisions) do
|
for _, col in pairs(objects.collisions) do
|
||||||
|
@ -24,32 +23,14 @@ function objects.DrawCollisions()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- returns true if theres a collision at that point. also marks collisioned tile as collision true
|
-- returns true if theres a collision at that point. also marks collisioned tile as collision true
|
||||||
function isThereCollisionAt(x,y)
|
function isThereObjectAt(x,y,objectType)
|
||||||
local result = false
|
local result = false
|
||||||
for _, col in pairs(objects.collisions) do
|
for _, col in pairs(objectType) do
|
||||||
if x >= col.from.x and x <= col.to.x and y >= col.from.y and y <= col.to.y then
|
if x >= col.from.x
|
||||||
result = true
|
and x <= col.to.x
|
||||||
col.collision = true
|
and y >= col.from.y
|
||||||
end
|
and y <= col.to.y
|
||||||
end
|
and col.disable ~= true then
|
||||||
return result
|
|
||||||
end
|
|
||||||
|
|
||||||
function isTherePlatformAt(x,y)
|
|
||||||
local result = false
|
|
||||||
for _, col in pairs(objects.platforms) do
|
|
||||||
if x >= col.from.x and x <= col.to.x and y >= col.from.y and y <= col.to.y and col.disable ~= true then
|
|
||||||
result = true
|
|
||||||
col.collision = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return result
|
|
||||||
end
|
|
||||||
|
|
||||||
function isThereLadderAt(x,y)
|
|
||||||
local result = false
|
|
||||||
for _, col in pairs(objects.ladders) do
|
|
||||||
if x >= col.from.x and x <= col.to.x and y >= col.from.y and y <= col.to.y and col.disable ~= true then
|
|
||||||
result = true
|
result = true
|
||||||
col.collision = true
|
col.collision = true
|
||||||
end
|
end
|
||||||
|
@ -60,28 +41,13 @@ end
|
||||||
function isThereAnyCollisionAt(x,y)
|
function isThereAnyCollisionAt(x,y)
|
||||||
local result = false
|
local result = false
|
||||||
if not result then
|
if not result then
|
||||||
for _, col in pairs(objects.collisions) do
|
result = isThereObjectAt(x,y,objects.collisions)
|
||||||
if x >= col.from.x and x <= col.to.x and y >= col.from.y and y <= col.to.y then
|
|
||||||
result = true
|
|
||||||
col.collision = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if not result then
|
if not result then
|
||||||
for _, col in pairs(objects.ladders) do
|
result = isThereObjectAt(x,y,objects.ladders)
|
||||||
if x >= col.from.x and x <= col.to.x and y >= col.from.y and y <= col.to.y and col.disable ~= true then
|
|
||||||
result = true
|
|
||||||
col.collision = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if not result then
|
if not result then
|
||||||
for _, col in pairs(objects.platforms) do
|
result = isThereObjectAt(x,y,objects.platforms)
|
||||||
if x >= col.from.x and x <= col.to.x and y >= col.from.y and y <= col.to.y and col.disable ~= true then
|
|
||||||
result = true
|
|
||||||
col.collision = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
id = 1,
|
id = 1,
|
||||||
|
force = 0,
|
||||||
|
overlay_tileset = tileset.books,
|
||||||
type = "whole",
|
type = "whole",
|
||||||
depth = "foreground"
|
depth = "foreground"
|
||||||
},
|
},
|
|
@ -0,0 +1,80 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
id = 1,
|
||||||
|
type = "whole",
|
||||||
|
depth = "foreground"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id = 2,
|
||||||
|
type = "emtpy",
|
||||||
|
depth = "foreground"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id = 5,
|
||||||
|
type = "emtpy",
|
||||||
|
depth = "background"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id = 6,
|
||||||
|
type = "emtpy",
|
||||||
|
depth = "background"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id = 7,
|
||||||
|
type = "emtpy",
|
||||||
|
depth = "background"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id = 13,
|
||||||
|
type = "whole",
|
||||||
|
depth = "foreground"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id = 25,
|
||||||
|
overlay = {17,19,21,23},
|
||||||
|
type = "emtpy",
|
||||||
|
depth = "background"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id = 26,
|
||||||
|
overlay = {18,20,22,24},
|
||||||
|
type = "emtpy",
|
||||||
|
depth = "background"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id = 37,
|
||||||
|
overlay = {29,31,33,35,42,44,46,48},
|
||||||
|
type = "emtpy",
|
||||||
|
depth = "background"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id = 38,
|
||||||
|
overlay = {30,32,34,36,41,43,45,47},
|
||||||
|
type = "emtpy",
|
||||||
|
depth = "background"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id = 49,
|
||||||
|
overlay = {53,55,57,59},
|
||||||
|
type = "emtpy",
|
||||||
|
depth = "background"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id = 50,
|
||||||
|
overlay = {54,56,58,60},
|
||||||
|
type = "emtpy",
|
||||||
|
depth = "background"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id = 61,
|
||||||
|
overlay = {1},
|
||||||
|
type = "emtpy",
|
||||||
|
depth = "background"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id = 62,
|
||||||
|
overlay = {1},
|
||||||
|
type = "emtpy",
|
||||||
|
depth = "background"
|
||||||
|
}
|
||||||
|
}
|
18
main.lua
18
main.lua
|
@ -34,6 +34,7 @@ function love.load()
|
||||||
table.insert(LoadedEntities,main_Player)
|
table.insert(LoadedEntities,main_Player)
|
||||||
table.insert(LoadedEntities,Kupo:New(700,150))
|
table.insert(LoadedEntities,Kupo:New(700,150))
|
||||||
table.insert(LoadedEntities,Kupo:New(800,150))
|
table.insert(LoadedEntities,Kupo:New(800,150))
|
||||||
|
CreateLight(200,64,80,nil,5,{1,0,0})
|
||||||
main_Player.sprite = love.graphics.newImage("assets/characters/nancy/idle1.png")
|
main_Player.sprite = love.graphics.newImage("assets/characters/nancy/idle1.png")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -85,7 +86,7 @@ function love.keypressed(key)
|
||||||
end
|
end
|
||||||
|
|
||||||
if key == "f2" then
|
if key == "f2" then
|
||||||
main_Player.pos.x, main_Player.pos.y = 0,-0.1
|
main_Player.pos.x, main_Player.pos.y = -16,-0.1
|
||||||
end
|
end
|
||||||
|
|
||||||
if key == "f3" then
|
if key == "f3" then
|
||||||
|
@ -129,7 +130,7 @@ function love.draw()
|
||||||
local pcr, pcg, pcb, pca = love.graphics.getColor()
|
local pcr, pcg, pcb, pca = love.graphics.getColor()
|
||||||
|
|
||||||
love.graphics.setCanvas(Canvas.Darkness)
|
love.graphics.setCanvas(Canvas.Darkness)
|
||||||
DoDarkness()
|
SetDarkness()
|
||||||
DoLights()
|
DoLights()
|
||||||
DoBorder()
|
DoBorder()
|
||||||
|
|
||||||
|
@ -137,19 +138,24 @@ function love.draw()
|
||||||
love.graphics.setColor(1,1,1,1)
|
love.graphics.setColor(1,1,1,1)
|
||||||
love.graphics.setCanvas()
|
love.graphics.setCanvas()
|
||||||
love.graphics.scale(1,1)
|
love.graphics.scale(1,1)
|
||||||
--DrawDarkness()
|
DrawDarkness()
|
||||||
-- HUD
|
-- HUD
|
||||||
-- Scale control
|
-- Scale control
|
||||||
textScale = 0.5
|
textScale = 0.5
|
||||||
|
|
||||||
--debug
|
--debug
|
||||||
if debug then DebugUI() end
|
if debug then DebugUI() end
|
||||||
if debug_collision then DebugColisions() end
|
if debug_collision then
|
||||||
|
love.graphics.setCanvas(Canvas.Darkness)
|
||||||
|
SetDarkness()
|
||||||
|
love.graphics.setCanvas()
|
||||||
|
--DrawDarkness()
|
||||||
|
DebugColisions()
|
||||||
|
DebugEntities()
|
||||||
|
end
|
||||||
|
|
||||||
-- reset color
|
-- reset color
|
||||||
love.graphics.setColor(pcr,pcg,pcb,pca)
|
love.graphics.setColor(pcr,pcg,pcb,pca)
|
||||||
|
|
||||||
|
|
||||||
local pcr, pcg, pcb, pca = love.graphics.getColor()
|
local pcr, pcg, pcb, pca = love.graphics.getColor()
|
||||||
if do_pause then PauseUI() end
|
if do_pause then PauseUI() end
|
||||||
love.graphics.setColor(pcr,pcg,pcb,pca)
|
love.graphics.setColor(pcr,pcg,pcb,pca)
|
||||||
|
|
|
@ -2,10 +2,14 @@
|
||||||
(X) REHANDLE ANIMATIONS
|
(X) REHANDLE ANIMATIONS
|
||||||
(X) 3 COLOR PALETTE (GOLD)
|
(X) 3 COLOR PALETTE (GOLD)
|
||||||
(X) MASKS FUNCTIONALITY
|
(X) MASKS FUNCTIONALITY
|
||||||
( ) MAKE ARROW CANVAS SO THAT ARROWS WHEN STUCK CAN BE STORED AS IMAGE AND ARE NOT LAGGY!!!
|
( ) MAKE ARROW CANVAS SO THAT
|
||||||
|
ARROWS WHEN STUCK CAN BE STORED
|
||||||
|
AS IMAGE AND NOT ENTITIES!!!
|
||||||
( ) DO GODS
|
( ) DO GODS
|
||||||
( ) DO DAMAGE TO PLAYER
|
( ) DO DAMAGE TO PLAYER
|
||||||
( ) DO FAIRY
|
( ) DO FAIRY
|
||||||
( ) DO FLIES
|
( ) DO FLIES
|
||||||
( ) DO UI
|
( ) DO UI
|
||||||
( ) MAKE PHYSICS CONSISTENT
|
> ( ) MAKE PHYSICS CONSISTENT
|
||||||
|
> > ( ) MAKE HITBOXES
|
||||||
|
> > ( ) PHYSICS BY FRAME
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Barry
|
||||||
|
Magma Crisp "Maggie"
|
Loading…
Reference in New Issue