Pages are great for pop up boxes. You can add buttons and size it and move it to taste.
Here's a popup box using sprites I was working on. It just explodes a pop up box in the center of the screen and shrinks it away. Uses some sound effects. I could'nt use BUTTONS for a real button because BUTTONS don't seem to be scanned by the ' sprite scan '
Code: Select all
'
'popup message box by Dav
graphics
shadow on
refresh off
'draw box & border
_line (0,0,300,300,1,1,1,1)
_line (5,5,295,295,1,0,0,1)
_line (0,0,300,300,0,0,0,0)
'draw title & message
_text ("NOTICE",80,20,"",36,1,1,1)
_text ("This is a message",40,80,"",22,0,1,1)
_text ("that can explode",40,110,"",22,0,1,1)
_text ("in and out.",40,140,"",22,0,1,1)
'draw button
_line (100,225,200,275,1,1,1,1)
_line (100,225,200,275,0,0,0,0)
_text ("Close",115,240,"",22,0,0,0)
'Now scan whole box as a sprite
sprite "test" scan 0,0,302,302
sprite "test" show 'turn it on
'move it out of the way
sprite "test" at -2000,-2000
graphics clear 0,0,0
refresh on
'draw something pretty.
for y=0 to screen_height() step 4
draw color rnd(255)/255,rnd(255)/255,rnd(255)/255
draw line 0,y to screen_width(),y
next y
pause .5
'find center of screen
'the -150 is half size of our box
x = screen_width()/2-150
y = screen_height()/2-150
'play a sfx for box exploding in...
notes set "9:tc6d6e6f6g6a6b6c7"
notes play
'scale in the message box sprite
for t = 1 to 100 step 2
sprite "test" at x,y scale t/100
pause .005
next t
'wait for user to click close
do
tx = touch_x(0) ! ty = touch_y(0)
if tx>x+100 and tx<x+200 then
if ty>y+225 and ty<y+275 then
'play a click sfx
notes set "108:c7" ! notes play
pause .2 ! break
end if
end if
until 0
'play sfx for box going away
notes set "9:tc7b6a6g6f6e6d6c6"
notes play
'dissapear box,scale it out...
for t = 100 to 0 step -2
sprite "test" at x,y scale t/100
pause .005
next t
pause .5
text
end
def _line (x1,y1,x2,y2,fill,r,g,b)
'Combined draw rect,draw line, fill rect
'to this one function, like Qbasic does it.
'Draws a line or box, hollow or filled.
if fill=1 then
fill color r,g,b
fill rect x1,y1 to x2,y2
else
draw color r,g,b
draw rect x1,y1 to x2,y2
end if
end def
def _text (text$,x,y,font$,size, r,g,b)
'just a one-line way to draw text
if font$<>"" then draw font name font$
if size>0 then draw font size size
draw color r,g,b
draw text text$ at x,y
end def