Log In  

How do I make the player 2 keys work? I'm trying to make s and f the movement for p2 but it won't work. It's just a little game movement thing. The code is here:

function _init()
position = 63
p = 63
end

function _update()
if btn(➡️) then
position+=1
end
if btn(⬅️) then
position-=1
end
if btn() then
p-=1
end
if btn() then
p+=1
end
end

function _draw()
cls()
spr(1,position,63)
player1score = 0
player2score = 0
player1name = "wooper"
player2name = "quagsire"
print(player1name)
print(player1score)
print(player2name)
print(player2score)
spr(2,p,73)
end

P#135407 2023-10-04 16:54 ( Edited 2023-10-04 16:55)

you need to pass a parameter to the btn/btnp functions to get another player than p1:
if btn(⬅️,1) then player2x -= 1 end

https://www.lexaloffle.com/dl/docs/pico-8_manual.html#BTN

P#135409 2023-10-04 17:14 ( Edited 2023-10-04 17:14)

thanks @merwok

P#135410 2023-10-04 17:26

wait @merwok, so I have the ability to move p2 left but now i cant move p1 at all, and i have no idea how to make p2 have more buttons aswell so i am quite stuck, help please
Update: I can move p2 up down left and right but now p1 cant move at all

P#135446 2023-10-05 11:09 ( Edited 2023-10-05 11:53)

[Please log in to post a comment]