examples/moveplayer: test 2 players

This commit is contained in:
Kazhnuz 2019-04-11 19:18:51 +02:00
parent a81ac5b819
commit f61cb21d58
2 changed files with 19 additions and 4 deletions

View file

@ -1,16 +1,30 @@
return { return {
[1] = { [1] = {
type = "keyboard",
keys = {
["left"] = "q",
["right"] = "d",
["up"] = "z",
["down"] = "s",
["A"] = "lshift",
["B"] = "lctrl",
["C"] = "w",
["start"] = "space",
["select"] = "c"
}
},
[2] = {
type = "keyboard", type = "keyboard",
keys = { keys = {
["left"] = "left", ["left"] = "left",
["right"] = "right", ["right"] = "right",
["up"] = "up", ["up"] = "up",
["down"] = "down", ["down"] = "down",
["A"] = "a", ["A"] = "1",
["B"] = "z", ["B"] = "2",
["C"] = "e", ["C"] = "3",
["start"] = "return", ["start"] = "return",
["select"] = "space" ["select"] = "space"
} }
} },
} }

View file

@ -32,6 +32,7 @@ function MovePlayer:new()
self.world = World(self, "examples.gameplay.moveplayer.actors") self.world = World(self, "examples.gameplay.moveplayer.actors")
self.world:addPlayer(self.world.obj.Player(self.world, 16, 16)) self.world:addPlayer(self.world.obj.Player(self.world, 16, 16))
self.world:addPlayer(self.world.obj.Player(self.world, 424 - 16, 16), 2)
end end
function MovePlayer:update(dt) function MovePlayer:update(dt)