I would like to see your try at the code before 'correcting' the code otherwise we be just doing it for you.
Your first task would be to get cars moving on thier own from right to left or whatever direction.
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
PSN ID: splodger15
I would like to see your try at the code before 'correcting' the code otherwise we be just doing it for you.
Your first task would be to get cars moving on thier own from right to left or whatever direction.
I only know very basic Lua
PSN ID: splodger15
Getting a car to move from right to left doesn't take any more knowledge then what you already know from the code you posted.
One word. Timer, random. That should be all you need.
Cloudy
I am not sure what the code would be
PSN ID: splodger15
Lets put it this way, if you wanted to move the player left every frame without the player needing to press the D-pad, what would you do?
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks