feat: add basic autorun on shoot maps
This commit is contained in:
parent
93ce28f3ba
commit
a7a0bde8ea
3 changed files with 24 additions and 12 deletions
|
@ -28,18 +28,7 @@ end
|
||||||
function Player:updateStart(dt)
|
function Player:updateStart(dt)
|
||||||
self.xfrc, self.yfrc = 480*3, 480*3
|
self.xfrc, self.yfrc = 480*3, 480*3
|
||||||
|
|
||||||
if self.keys["up"].isDown then
|
self:basicMovements()
|
||||||
self.ysp = -160
|
|
||||||
end
|
|
||||||
if self.keys["down"].isDown then
|
|
||||||
self.ysp = 160
|
|
||||||
end
|
|
||||||
if self.keys["left"].isDown then
|
|
||||||
self.xsp = -160
|
|
||||||
end
|
|
||||||
if self.keys["right"].isDown then
|
|
||||||
self.xsp = 160
|
|
||||||
end
|
|
||||||
|
|
||||||
if self.keys["A"].isPressed and (self.onGround) then
|
if self.keys["A"].isPressed and (self.onGround) then
|
||||||
self.zsp = 280*1.33
|
self.zsp = 280*1.33
|
||||||
|
@ -50,6 +39,27 @@ function Player:updateStart(dt)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Player:basicMovements()
|
||||||
|
|
||||||
|
if self.keys["up"].isDown then
|
||||||
|
self.ysp = -160
|
||||||
|
end
|
||||||
|
if self.keys["down"].isDown then
|
||||||
|
self.ysp = 160
|
||||||
|
end
|
||||||
|
if (self.world.autorun == true) then
|
||||||
|
self.xsp = 160
|
||||||
|
else
|
||||||
|
if self.keys["left"].isDown then
|
||||||
|
self.xsp = -160
|
||||||
|
end
|
||||||
|
if self.keys["right"].isDown then
|
||||||
|
self.xsp = 160
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
function Player:collisionResponse(collision)
|
function Player:collisionResponse(collision)
|
||||||
if collision.other.type == "collectible" then
|
if collision.other.type == "collectible" then
|
||||||
collision.other.owner:getPicked(self)
|
collision.other.owner:getPicked(self)
|
||||||
|
|
|
@ -10,6 +10,7 @@ function ParentWorld:new(scene, maptype, mapname)
|
||||||
ParentWorld.super.new(self, scene, "game.modules.world.actors", mappath, maptype)
|
ParentWorld.super.new(self, scene, "game.modules.world.actors", mappath, maptype)
|
||||||
|
|
||||||
self.mapname = mapname
|
self.mapname = mapname
|
||||||
|
self.autorun = false
|
||||||
end
|
end
|
||||||
|
|
||||||
function ParentWorld:createMapController()
|
function ParentWorld:createMapController()
|
||||||
|
|
|
@ -8,6 +8,7 @@ function ShootWorld:new(scene, mapname)
|
||||||
ShootWorld.super.new(self, scene, "shoot", mapname)
|
ShootWorld.super.new(self, scene, "shoot", mapname)
|
||||||
|
|
||||||
self.mapname = mapname
|
self.mapname = mapname
|
||||||
|
self.autorun = true
|
||||||
end
|
end
|
||||||
|
|
||||||
function ShootWorld:getViewCenter(x, y)
|
function ShootWorld:getViewCenter(x, y)
|
||||||
|
|
Loading…
Reference in a new issue