summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2017-02-09 18:05:05 +0100
committerAki <nthirtyone@gmail.com>2017-02-09 18:05:05 +0100
commit32d5db517b330963c737d29c693ad592ec62e697 (patch)
treebd19cb47f13eb698d36fe457cb54e352bf55086c
parenta7b1bcc6872579b0ed8dbce399352d3afca1a80f (diff)
parentc4cec4731cdf10ac2740775c08efbda571e58040 (diff)
downloadroflnauts-32d5db517b330963c737d29c693ad592ec62e697.zip
roflnauts-32d5db517b330963c737d29c693ad592ec62e697.tar.gz
roflnauts-32d5db517b330963c737d29c693ad592ec62e697.tar.bz2
Merge branch 'fix/draw'
-rw-r--r--maps/default.lua8
-rw-r--r--maps/ribbit.lua4
-rw-r--r--maps/rill.lua10
-rw-r--r--maps/starstorm.lua16
-rw-r--r--player.lua6
-rw-r--r--selector.lua2
6 files changed, 24 insertions, 22 deletions
diff --git a/maps/default.lua b/maps/default.lua
index 2ea17a6..05b8dc9 100644
--- a/maps/default.lua
+++ b/maps/default.lua
@@ -21,25 +21,25 @@ return {
{
x = -91,
y = 0,
- shape = {0,1, 181,1, 181,10, 96,76, 86,76, 0,10},
+ shape = {0,1, 180,1, 180,10, 95,76, 86,76, 0,10},
sprite = "assets/platforms/default-big.png"
},
{
x = 114,
y = 50,
- shape = {0,1, 52,1, 52,30, 0,30},
+ shape = {0,1, 51,1, 51,18, 0,18},
sprite = "assets/platforms/default-side.png"
},
{
x = -166,
y = 50,
- shape = {0,1, 52,1, 52,30, 0,30},
+ shape = {0,1, 51,1, 51,18, 0,18},
sprite = "assets/platforms/default-side.png"
},
{
x = -17,
y = -50,
- shape = {0,1, 34,1, 34,16, 0,16},
+ shape = {0,1, 33,1, 33,14, 0,14},
sprite = "assets/platforms/default-top.png"
}
},
diff --git a/maps/ribbit.lua b/maps/ribbit.lua
index 8b497b4..c3f5c78 100644
--- a/maps/ribbit.lua
+++ b/maps/ribbit.lua
@@ -32,13 +32,13 @@ return {
{
x = -70,
y = -5,
- shape = {0,3, 140,3, 132,26, 8,26},
+ shape = {0,3, 139,3, 134,24, 5,24},
sprite = "assets/platforms/ribbit-top.png"
},
{
x = -54,
y = 63,
- shape = {0,3, 108,3, 84,41, 24,41},
+ shape = {0,3, 107,3, 75,44, 32,44},
sprite = "assets/platforms/ribbit-bottom.png"
}
},
diff --git a/maps/rill.lua b/maps/rill.lua
index e150335..83c02f2 100644
--- a/maps/rill.lua
+++ b/maps/rill.lua
@@ -20,31 +20,31 @@ return {
{
x = -151,
y = 25,
- shape = {0,0, 56,0, 56,12, 0,12},
+ shape = {0,0, 55,0, 55,11, 0,11},
sprite = "assets/platforms/rill-flat-left.png"
},
{
x = 93,
y = 25,
- shape = {0,0, 56,0, 56,12, 0,12},
+ shape = {0,0, 55,0, 55,11, 0,11},
sprite = "assets/platforms/rill-flat-right.png"
},
{
x = -24,
y = 55,
- shape = {0,0, 49,0, 47,18, 3,18, 0,4},
+ shape = {0,0, 48,0, 47,15, 1,15},
sprite = "assets/platforms/rill-center.png"
},
{
x = -112,
y = 80,
- shape = {78,30, 17,0, 0,0, 0,7, 78,45},
+ shape = {77,30, 17,0, 0,0, 0,7, 77,44},
sprite = "assets/platforms/rill-slope-left.png"
},
{
x = 35,
y = 80,
- shape = {0,30, 61,0, 78,0, 78,7, 0,45},
+ shape = {0,30, 60,0, 77,0, 77,7, 0,44},
sprite = "assets/platforms/rill-slope-right.png"
}
},
diff --git a/maps/starstorm.lua b/maps/starstorm.lua
index 0540009..7f00633 100644
--- a/maps/starstorm.lua
+++ b/maps/starstorm.lua
@@ -23,42 +23,42 @@ return {
x = -170,
y = -55,
shape = {
- {0,1, 33,1, 39,6, 39,19, 31,21, 3,21},
- {40,6, 115,6, 114,14, 40,14}
+ {0,1, 33,1, 39,6, 39,21, 31,21, 0,21},
+ {40,6, 115,6, 115,14, 40,14}
},
sprite = "assets/platforms/starstorm-left-top.png"
},
{
x = -156,
y = -2,
- shape = {1,0, 109,0, 108,18, 1,20},
+ shape = {0,0, 109,0, 109,20, 0,20},
sprite = "assets/platforms/starstorm-left-middle.png"
},
{
x = -160,
y = 69,
- shape = {0,4, 17,1, 97,1, 102,6, 102,11, 97,16, 19,16, 1,11},
+ shape = {0,4, 8,4, 13,1, 102,1, 102,16, 19,16, 0,11},
sprite = "assets/platforms/starstorm-left-bottom.png"
},
{
x = 52,
y = -55,
shape = {
- {116,1, 83,1, 77,6, 77,19, 85,21, 113,21},
- {76,6, 1,6, 2,14, 76,14}
+ {115,1, 82,1, 76,6, 76,21, 84,21, 115,21},
+ {75,6, 0,6, 0,14, 75,14}
},
sprite = "assets/platforms/starstorm-right-top.png"
},
{
x = 44,
y = -2,
- shape = {109,0, 1,0, 2,18, 109,20},
+ shape = {109,0, 0,0, 0,20, 109,20},
sprite = "assets/platforms/starstorm-right-middle.png"
},
{
x = 55,
y = 69,
- shape = {103,4, 86,1, 6,1, 1,6, 1,11, 6,16, 84,16, 102,11},
+ shape = {102,4, 94,4, 89,1, 0,1, 0,16, 83,16, 102,11},
sprite = "assets/platforms/starstorm-right-bottom.png"
},
{
diff --git a/player.lua b/player.lua
index b6d4e3f..6195da6 100644
--- a/player.lua
+++ b/player.lua
@@ -292,9 +292,11 @@ function Player:draw(offset_x, offset_y, scale, debug)
local scale = scale or 1
local debug = debug or false
local x, y = self:getPosition()
- -- pixel grid
+ -- pixel grid ; `approx` selected to prevent floating characters on certain conditions
+ local approx = math.floor
+ if (y - math.floor(y)) > 0.5 then approx = math.ceil end
+ local draw_y = (approx(y) + offset_y) * scale
local draw_x = (math.floor(x) + offset_x) * scale
- local draw_y = (math.floor(y) + offset_y) * scale
-- sprite draw
Animated.draw(self, draw_x, draw_y, self.rotate, self.facing*scale, scale, 12, 15)
-- debug draw
diff --git a/selector.lua b/selector.lua
index 851e451..61401e7 100644
--- a/selector.lua
+++ b/selector.lua
@@ -284,7 +284,7 @@ function Selector:controlpressed(set, action, key)
if action == "attack" then
local name = self:getListValue(self:getSelection(n))
if name == "random" then
- self:setSelection(n, self:rollRandom({1})) -- avoid empty naut
+ self:setSelection(n, self:rollRandom({1,2})) -- avoid empty naut
self.locks[n] = true
else
-- If not empty or if first is allowed. Additionaly must be unique selection.