Game Programming and Development Tools

Collision Detection - BM – Mene-Mene

Mene-Mene

Member

Posts: 1398
From: Fort Wayne, IN, USA
Registered: 10-23-2006
Okay I'm working on WOB (the Well Of Bethlehem) and I'm converting it to BM. I'm doing the menus and need to detect collision between the mouse, and the button images. In BB I use ImagesOverlap. So I use ImagesCollide instead. It tries to convert my image to a interger for some WEIRD reason. So I try CollideImage, and CollideRect, unfortunetly It requires 2 fields I don't know about, I basically copied the examples in it. But it does nothing now. Here's the code:


Function MainMenu()

CurPlayer.Background = LoadImage("Menu Background.bmp")
Local welcometext:TImage = LoadImage("Welcome Text 2 Edit.bmp")
Local playtext:TImage = LoadAnimImage("Play Text Anim.bmp",200,133,0,2)
Local playframe = 0
Local helptext:TImage = LoadAnimImage("Help Text Anim.bmp",250,133,0,2)
Local helpframe = 0
Local optionstext:TImage = LoadAnimImage("Options Text Anim.bmp",375,133,0,2)
Local optionsframe = 0
Local exittext:TImage = LoadAnimImage("Quit Text Anim.bmp",200,133,0,2)
Local exitframe = 0

While Not KeyHit(27)

Cls

DrawImage CurPlayer.background,0,0
DrawImage welcometext,0,0
DrawImage playtext,412,200,playframe
DrawImage helptext,382,333,helpframe
DrawImage optionstext,337,476,optionsframe
DrawImage exittext,412,599,exitframe
DrawImage CurPlayer.mouse,MouseX(),MouseY()

If CollideRect(412,200,ImageWidth(playtext),ImageHeight(playtext))

playframe = 1
Print "ON"

Else

playframe = 0

EndIf

If playframe:Int = 1

If MouseHit(1)

End

EndIf

EndIf

Flip

Wend

quit = Confirm("Are you sure you want to quit?")

If quit = 1 Then

End

ElseIf quit = 0 Then

MainMenu()

EndIf

End Function

------------------
MM out-
Thought travels much faster than sound, it is better to think something twice, and say it once, than to think something once, and have to say it twice.
"Frogs and Fauns! The tournament!" - Professor Winneynoodle/HanClinto