splodger15
October 29th, 2006, 16:30
Here is my code what i would like is cars that you will have to dodge out the way but i dont know what the bit of code would be can someone help please.
----------------------------------------------------------------
-- Created by splodger15
Room_width = 480
Room_height = 272
player1x = 15
player1y = 136
background =Image.load ("images/road.jpg")
player1=Image.load("images/car.JPG")
------functions
function checkcontrols()
pad = Controls.read()
if pad:start() then
exit = true
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
end
function drawall()
screen:blit (0,0,background)
screen:blit(player1x,player1y,player1)
screen.waitVblankStart()
screen.flip()
end
-- MAIN LOOP
while true do
if exit == true then
break
end
checkcontrols()
drawall()
end
----------------------------------------------------------------
-- Created by splodger15
Room_width = 480
Room_height = 272
player1x = 15
player1y = 136
background =Image.load ("images/road.jpg")
player1=Image.load("images/car.JPG")
------functions
function checkcontrols()
pad = Controls.read()
if pad:start() then
exit = true
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
end
function drawall()
screen:blit (0,0,background)
screen:blit(player1x,player1y,player1)
screen.waitVblankStart()
screen.flip()
end
-- MAIN LOOP
while true do
if exit == true then
break
end
checkcontrols()
drawall()
end