
-----------------------------------
RoCkEr
Sat Nov 04, 2006 9:05 pm

game help please!!!
-----------------------------------
here is my code for my game

iew.Set ("graphics:max,max")
var counter : int := Pic.FileNew ("counter copy.jpg")
var current_tool : int := 0
var mx, my, mb : int
var font : int := Font.New ("sans serif:24:bold")
var lvl1 : int := Pic.FileNew ("SmallInferno.jpg")
var lvl2 : int := Pic.FileNew ("SmallItaly.jpg")
var lvl3 : int := Pic.FileNew ("SmallOffice.jpg")
var lvl4 : int := Pic.FileNew ("SmallMilitia.jpg")
var lvl5 : int := Pic.FileNew ("Smallprodigy.jpg")
var level:int:=0
var level1:int:= Pic.FileNew ("inferno.jpg")
var level2:int:= Pic.FileNew ("Italy.jpg")
var level3:int:= Pic.FileNew ("Office1.jpg")
var level4:int:= Pic.FileNew ("Militia.jpg")
var level5:int:= Pic.FileNew ("prodigy.jpg")
loop
    Pic.Draw (counter, 0, 0, picCopy) %full screen
    exit when hasch

    Font.Draw ("Press enter to start", 50, 200, font, brightgreen)


end loop
cls

drawfillbox (0, 0, maxx, maxy, black)
drawbox (200, 200, 150, 150, red)
drawbox (200, 350, 150, 300, red)
drawbox (200, 400, 150, 450, red)
drawbox (800, 200, 750, 150, red)
drawbox (800, 350, 750, 300, red)
Pic.Draw (lvl1, 150, 130, picCopy)
Pic.Draw (lvl2, 110, 280, picCopy)
Pic.Draw (lvl3, 150, 400, picCopy)
Pic.Draw (lvl4, 750, 300, picCopy)
Pic.Draw (lvl5, 750, 150, picCopy)


loop
    mousewhere (mx, my, mb)
if mb = 1 and mx > 200 and my > 200 and mx < 150 and my < 150 then
Pic.Draw (level1,0,0,picCopy)
elsif mb = 1 and mx > 200 and my > 350 and mx < 150 and my < 300 then
Pic.Draw (level2,0,0,picCopy)
elsif mb = 1 and mx > 200 and my > 400 and mx < 150 and my < 400 then
Pic.Draw (level3,0,0,picCopy)
elsif mb = 1 and mx > 800 and my > 200 and mx < 750 and my < 300 then
Pic.Draw(level4,0,0,picCopy)
elsif mb = 1 and mx > 800 and my > 350 and mx < 750 and my < 300 then
Pic.Draw(level5,0,0,picCopy)
exit
end if
end loop


i am trying to get it so if i click on one of the small pic it will open the level  can someone please help me. Thank you.

-----------------------------------
jamonathin
Sat Nov 04, 2006 9:28 pm


-----------------------------------
You're going to need some variables, or at least some co-ordinates that represent the lower left hand corner of your picture.  So use that to your advantage and incorporate that into your mousewhere 'if' statements.  Like such:


var mx, my, mb : int %mouse variables
var x, y: int := 100 %lower left of pic variables
var pic : int := Pic.FileNew("SomeRandomPic.jpg")

Pic.Draw (pic, x, y, picCopy)

loop
     mousewhere(mx, my, mb)
    
     if mx >= x and my >= y and mx 