Well, happy x-mas, and since I actually got the writing to show up in this code I need help finalizing it.qwikrazor87 wrote:Hmm... I don't see what's wrong.
In this part the player will cross the other one and a split second later the writing will disappear, so what I ask is how do you keep the text of whose it on screen but print only who is it on screen because when the players cross it prints "player2 is it" and "player1 is it" on the screen at the same time.
Code: Select all
if player1x == player2x and player1y == player2y then
screen:print(20, 20, "player2 is it",white)
end
if player2x == player1x and player2y == player1y then
screen:print(20, 20, "player1 is it",white)
end
Code: Select all
--Created by dragonxtamer596
black = Color.new(0,0,0)
white = Color.new(255,255,255)
Room_width = 480
Room_height = 272
player1x =240
player1y =136
player2x =120
player2y =80
background=Image.load("images/Background.PNG")
player1=Image.load("images/Player1.PNG")
player2=Image.load("images/Player2.PNG")
function checkcontrols()
pad = Controls.read()
if pad:start() then
screen:fillRect(0, 0, 480, 272, black)
dofile("index.lua")
end
if pad:right() then
player1x = player1x +2
end
if pad:left() then
player1x = player1x -2
end
if pad:up() then
player1y = player1y -2
end
if pad:down() then
player1y = player1y +2
end
if pad:circle() then
player2x = player2x +2
end
if pad:square() then
player2x = player2x -2
end
if pad:triangle() then
player2y = player2y -2
end
if pad:cross() then
player2y = player2y +2
end
end
function drawall()
screen:blit(0,0,background)
screen:blit(player1x,player1y,player1)
screen:blit(player2x,player2y,player2)
if player1x == player2x and player1y == player2y then
screen:print(20, 20, "player2 is it",white)
end
if player2x == player1x and player2y == player1y then
screen:print(20, 20, "player1 is it",white)
end
screen.waitVblankStart()
screen.flip()
end
while true do
checkcontrols()
drawall()
end