Restored from previous forum. Originally posted by MrVainSCL.
Hi blue-speed!
I know the problem if you have a problem with your code and waiting for an answer which could help you to solve the problem - So i spent all my time in checking your code snip and wrote a small working example... I hope it is what you wanted...

Have a look to it and report me if its ok
Code: Select all
;---------------------------------------------
; StartUp -> Init all the needed system stuff
;---------------------------------------------
;
If InitMovie() = 0
MessageRequester("Error", "Can't initialize movie playback!", 0)
End ; If Init() failed, we will quit our program!
EndIf
;
If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse() = 0
MessageRequester("Error", "Can't open DirectX 7 Or later",0)
End ; If Init() failed, we will quit our program!
EndIf
;
If InitSound(10) = 0
MessageRequester("Error", "Can't open DirectX 7 Or SoundCard is not present",0)
End ; If Init() failed, we will quit our program!
EndIf
;
If OpenScreen(800,600,32,"Break-It") = 0
MessageRequester("Error","Could not open 800x600x32 screen",0)
End ; If OpenScreen failed, we will quit our program!
EndIf
;
;----------------------------
; StartUp -> Init global var
;----------------------------
;
Global OK : OK = 0
Global PLAYED : PLAYED = 0
Global PFRAME : PFRAME = 6
Global QFRAME : QFRAME = 5
Global CFRAME : CFRAME = 3
Global SFRAME : SFRAME = 4
Global STARTB : STARTB = 0
Global CREDITB : CREDITB = 0
Global QUITB : QUITB = 0
;
Global BOX1,BOX2,BOX3
;
;----------------------------
; StartUp -> Load SoundDatas
;----------------------------
;
LoadSound (0 ,"sfx\boing.wav")
LoadSound (1 ,"sfx\bonk.wav")
LoadSound (2 ,"sfx\evil-laf.wav")
;
;----------------------------
; StartUp -> Load MusicDatas
;----------------------------
;
LoadMovie (0 ,"sfx\level1.mid")
LoadMovie (1 ,"sfx\level2.mid")
;
;----------------------------
; StartUp -> Our Procedures
;----------------------------
;
Procedure Move_Pfeil()
;
;-------- Check Button 1 (red) --------
;
If MouseX() > 320 And MouseX() 220 And MouseY() 90 And MouseX() 350 And MouseY() 550 And MouseX() 350 And MouseY() DrawIntro
;----------------------------------------
Draw_Intro:
;
mygosub$ = "Gosub Draw_Intro"
Return
;
;----------------------------------------
; Subroutine -> DrawMenu
;----------------------------------------
Draw_Menue:
;
mygosub$ = "Gosub Draw_Menue"
Return
;
;----------------------------------------
; Subroutine -> GameStart
;----------------------------------------
Game_Start:
;
mygosub$ = "Gosub Game_Start"
Return
;
;----------------------------------------
; Subroutine -> GameCredits
;----------------------------------------
Game_Credits:
;
mygosub$ = "Gosub Game_Credits"
Return
;
;----------------------------------------
; Subroutine -> Game_Quit
;----------------------------------------
Game_Quit:
;
mygosub$ = "Gosub Game_Quit"
Return
;
;----------------------------------------
; Subroutine -> Draw boxes for example
;----------------------------------------
SUB_MrVainExample:
;
StartDrawing(ScreenOutput())
FrontColour (255,0,0) ; Box1 (red)
Box(320,220,200,80)
;
FrontColour (0,255,0) ; Box2 (green)
Box(90,350,100,150)
;
FrontColour (0,0,255) ; Box3 (blue)
Box(550,350,100,150)
StopDrawing()
;
Return
;
;----------------------------------------
; Subroutine -> Draw boxes for example
;----------------------------------------
SUB_CreateMousePointer:
;
StartDrawing(ScreenOutput())
FrontColour (127,127,127)
Box (0,0,16,16)
StopDrawing()
;
GrabSprite (0,0,0,16,16)
;
Return
;
;----------------------------------------
; Subroutine -> Debugger - Print Vars()
;----------------------------------------
SUB_PrintResults:
;
StartDrawing(ScreenOutput())
FrontColour(255,255,255)
DrawingMode(1)
Locate (20, 40) : DrawText("MouseX: "+Str(MouseX()))
Locate (20, 55) : DrawText("MouseY: "+Str(MouseY()))
;
Locate (20,100) : DrawText("OK: "+Str(OK))
Locate (20,115) : DrawText("PLAYED: "+Str(PLAYED))
Locate (20,130) : DrawText("PFRAME: "+Str(PFRAME))
Locate (20,145) : DrawText("QFRAME: "+Str(QFRAME))
Locate (20,160) : DrawText("CFRAME: "+Str(CFRAME))
Locate (20,175) : DrawText("SFRAME: "+Str(SFRAME))
Locate (20,190) : DrawText("STARTB: "+Str(STARTB))
Locate (20,205) : DrawText("CREDITB: "+Str(CREDITB))
Locate (20,220) : DrawText("QUITB: "+Str(QUITB))
;
Locate (320,380) : DrawText("Box1: "+Str(BOX1))
Locate (320,395) : DrawText("Box2: "+Str(BOX2))
Locate (320,410) : DrawText("Box3: "+Str(BOX3))
;
Locate (320,100) : DrawText("ProgramStatus: "+mygosub$)
StopDrawing()
Return
;
;----------------------------------------
This example works very fine ony my machine, playing background midi tune and when klicking on the red box you will listen to the *.wav sample Good luck...
PIII450, 256MB Ram, 6GB HD, RivaTNT, DirectX8.1, SB AWE64, Win98SE + Updates...
greetz
MrVainSCL! aka Thorsten