Thanks everyone for your help but I'm still having some problems.
Sub Main()
W = 640
H = 480
screen=CreateObject("roScreen", true, W, H)
if type(screen) <> "roScreen"
print "Unable to open screen"
return
endif
msgport = CreateObject("roMessagePort")
screen.SetPort(msgport)
DrawImg(screen)
End Sub
Sub DrawImg(scr as object)
x = int(128)
y = int(128)
port = scr.GetPort()
cw = int(scr.getwidth()/2)
ch = int(scr.getheight()/2)
logo = CreateObject("roBitmap", "pkg:/images/corporal.png")
while true
BackGround(scr)
scr.drawobject(x, y, logo)
scr.swapbuffers()
msg = wait(0, port)
if type(msg) = "roUniversalControlEvent" then
if (i = 3) then
scr.setalphaenable(true)
else
scr.setalphaenable(false)
end if
end if
end while
end sub
Sub Background(scr as object)
scr.clear(0)
cw = int(scr.getwidth()/2)
ch = int(scr.getheight()/2)
bg = CreateObject("roBitmap", "pkg:/images/grass.png")
scr.drawobject(cw-360, ch-240, bg)
End Sub
Here's the problem: I'll run my program on the roku, and if I press a button it will go back to the main screen. I'll run the program again and press a button nothing happens. So I press the home button, run the program again, press a button and it will end. So it just goes back and forth like that.
And I also have a question, instead of using moveto(), could I just draw the object at x and y and change their values?
Thanks for your help once again.