|
#1
|
|||
|
|||
|
As i have said Earlier, i am new in this! I've tried to put together a simple application of codes I got from Jbob182 (I hope it is okay) but I can't make it work. Can anyone help me?
sheight = screen.height()--declare width and hieght of screen for later refernce swidth = screen.width() --load images imgstart = image.load("start.png") imgclose = image.load("stop.png") imgball = image.load("ball.png") cblack = color.new(0,0,0) -- declare black menu="menu" function gameplay() screen.fillrect(0,0,swidth,sheight,cblack) imgball:draw(ball_x,ball_y); ball_x=200 -- put the ball in the middle of the screen ball_y=240-imgball:height(); -- set the height of the ball to the bottom of the screen end function menu() menu="menu"; screen.fillrect(0,0,swidth,sheight,cblack) imgstart:draw(50,50,150,150); imgclose:draw(200,50,150,150); if touch_x >= 50 and touch_x <= (50 + 150) and touch_y >= 50 and touch_y <= (150 + 50) then menu = "gameplay"; -- the user is now in gameplay mode so the ball will be active elseif touch_x >=200 and touch_x <= (150 + 200) and touch_y >= 50 and touch_y <= (150 + 50) then menu="break"; end end function homebutton() if button.click() == 1 then if menu == "menu" then menu="break" elseif menu == "gameplay" then menu="menu" end end end while true do if menu == "gameplay" then function gameplay() if menu == "menu" then function menu() if menu == "break" then function avbryt() end end end end end end if control.read() == 1 then if touch.click() == 1 then function menu() end function homebutton() end end end screen.update end imgstart:close(); imgclose:close(); imgball:close(); |
|
|
|||
|
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 11:13 PM.













Threaded Mode