Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 I Need Help With Gui Buttons! Whenever I Apply, There Is This Glitch Where In Next Procedure Buttons Are Still There!
Index -> General Discussion
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
master-awesome




PostPosted: Mon Jan 05, 2015 4:22 pm   Post subject: I Need Help With Gui Buttons! Whenever I Apply, There Is This Glitch Where In Next Procedure Buttons Are Still There!

I mean the screen is clear, but when you move the mouse to where they were positioned, there is a problem where the buttons are still working when they are not suppose to. Could you help me with disabling these buttons?

I've highlighted the buttons in red!

Code:
Quote:
Name: Master-Awesome
% Updated Date: 12/29/2014
import GUI
View.Set ("graphics:720;580")
var picID : int

% All Gaming Variables

% Keyboard Variable
var infont : int
var keyboard_controls1 : int := Pic.FileNew ("Testing/Game Control and Menu/Keyboard 1.jpg")
var keyboard_controls2 : int := Pic.FileNew ("Testing/Game Control and Menu/Keyboard 2.jpg")

% Flying Declare Variables
var mfx : int := 1
var mfy : int := 200
var dmfx : int
var dmfy : int
var dmfxc1 : int
var dmfyc1 : int
var dmfxc2 : int
var dmfyc2 : int
var dmfxc3 : int
var dmfyc3 : int
var dmfxc4 : int
var dmfyc4 : int
var sky_limit : int := 300
var fly_fireblastx : int := 360
var fly_fireblasty : int := 200
var fly_fireblastshape : int := 30
var fly_dfireblastshape : int := 30
var fire_movement : int := 40
var dmkill : real
var mkill1 : real
var mkill2 : real
var mgain : real
var dmgain : real

% Blast Bounderies
var bsky_limity1 : int := 200
var bsky_limity2 : int := 40
var bsky_limitx1 : int :=580
var bsky_limitx2 : int := 180

% Mario Boundery
var sky_limity1 : int := 240
var sky_limity2 : int := 230
var sky_limitx1 : int := 20
var sky_limitx2 : int := 1

% Mario Flies To The Right
var mario_flies_right1 : int := Pic.FileNew ("Testing/Game Test/Mario/Mario Flying Original/Mario-Flying-1.jpg")
var mario_flies_right2 : int := Pic.FileNew ("Testing/Game Test/Mario/Mario Flying Original/Mario-Flying-2.jpg")
var mario_flies_right3 : int := Pic.FileNew ("Testing/Game Test/Mario/Mario Flying Original/Mario-Flying-3.jpg")

% Mario Flies To The Left
var mario_flies_left1 : int := Pic.FileNew ("Testing/Game Test/Mario/Mario Flying Opposite Direction/Mario-Flying-Opposite-Direction-1.jpg")
var mario_flies_left2 : int := Pic.FileNew ("Testing/Game Test/Mario/Mario Flying Opposite Direction/Mario-Flying-Opposite-Direction-2.jpg")
var mario_flies_left3 : int := Pic.FileNew ("Testing/Game Test/Mario/Mario Flying Opposite Direction/Mario-Flying-Opposite-Direction-3.jpg")

% Dark Mario Flies To The Left
var dark_mario_flies_left1 : int := Pic.FileNew ("Testing/Game Test/Dark Mario/Mario Flying Opposite Direction/Mario-Flying-Opposite-Direction-1.jpg")
var dark_mario_flies_left2 : int := Pic.FileNew ("Testing/Game Test/Dark Mario/Mario Flying Opposite Direction/Mario-Flying-Opposite-Direction-2.jpg")
var dark_mario_flies_left3 : int := Pic.FileNew ("Testing/Game Test/Dark Mario/Mario Flying Opposite Direction/Mario-Flying-Opposite-Direction-3.jpg")

% Background Animation
var animation0 : int := Pic.FileNew ("Testing/Game Test/The Sky Battle Stage/0.jpg")
var animation1 : int := Pic.FileNew ("Testing/Game Test/The Sky Battle Stage/1.jpg")
var animation2 : int := Pic.FileNew ("Testing/Game Test/The Sky Battle Stage/2.jpg")
var animation3 : int := Pic.FileNew ("Testing/Game Test/The Sky Battle Stage/3.jpg")
var animation4 : int := Pic.FileNew ("Testing/Game Test/The Sky Battle Stage/4.jpg")
var animation5 : int := Pic.FileNew ("Testing/Game Test/The Sky Battle Stage/5.jpg")
var animation6 : int := Pic.FileNew ("Testing/Game Test/The Sky Battle Stage/6.jpg")

% Background Animation
var f0 : int := Pic.FileNew ("Testing/Game Test/Mario's Death/0.jpg")
var f1 : int := Pic.FileNew ("Testing/Game Test/Mario's Death/1.jpg")
var f2 : int := Pic.FileNew ("Testing/Game Test/Mario's Death/2.jpg")
var f3 : int := Pic.FileNew ("Testing/Game Test/Mario's Death/3.jpg")
var f4 : int := Pic.FileNew ("Testing/Game Test/Mario's Death/4.jpg")
var f5 : int := Pic.FileNew ("Testing/Game Test/Mario's Death/5.jpg")
var f6 : int := Pic.FileNew ("Testing/Game Test/Mario's Death/6.jpg")
var f7 : int := Pic.FileNew ("Testing/Game Test/Mario's Death/7.jpg")
var f8 : int := Pic.FileNew ("Testing/Game Test/Mario's Death/8.jpg")
var f9 : int := Pic.FileNew ("Testing/Game Test/Mario's Death/9.jpg")
var f10 : int := Pic.FileNew ("Testing/Game Test/Mario's Death/10.jpg")
var f11 : int := Pic.FileNew ("Testing/Game Test/Mario's Death/11.jpg")

% Mario Walking Right
var mario_walks_right2 : int := Pic.FileNew ("Testing/Game Test/Mario/Mario Walking Original/Walking-Mario-2.jpg")
var mario_walks_right3 : int := Pic.FileNew ("Testing/Game Test/Mario/Mario Walking Original/Walking-Mario-3.jpg")
var mario_walks_right1 : int := Pic.FileNew ("Testing/Game Test/Mario/Mario Walking Original/Walking-Mario-1.jpg")

% Mario Walking Left
var mario_walks_left2 : int := Pic.FileNew ("Testing/Game Test/Mario/Mario Walking Opposite Direction/Mario-Walking-Opposite-Direction-2.jpg")
var mario_walks_left3 : int := Pic.FileNew ("Testing/Game Test/Mario/Mario Walking Opposite Direction/Mario-Walking-Opposite-Direction-3.jpg")
var mario_walks_left1 : int := Pic.FileNew ("Testing/Game Test/Mario/Mario Walking Opposite Direction/Mario-Walking-Opposite-Direction-1.jpg")

% Dark Mario Waling Left
var dark_mario_walks_left2 : int := Pic.FileNew ("Testing/Game Test/Dark Mario/Mario Walking Opposite Direction/Mario-Walking-Opposite-Direction-2.jpg")
var dark_mario_walks_left3 : int := Pic.FileNew ("Testing/Game Test/Dark Mario/Mario Walking Opposite Direction/Mario-Walking-Opposite-Direction-3.jpg")
var dark_mario_walks_left1 : int := Pic.FileNew ("Testing/Game Test/Dark Mario/Mario Walking Opposite Direction/Mario-Walking-Opposite-Direction-1.jpg")

% Declare Variables
var x : int := 1
var y : int := 36
var dx : int := 600
var dy : int := 36
var xm : int := 720
var ym : int := 360
var dxm : int := 720
var dym : int := 200
var key1 : string (1)
var key2 : string (1)
var mlives : int := 3
var dmlives : int := 9
var fireblastx : int := 600
var fireblasty : int := 80
var fireblastshape : int := 30
var dfireblastx : int
var dfireblasty : int
var dfireblastxc1 : int
var dfireblastyc1 : int
var dfireblastxc2 : int
var dfireblastyc2 : int
var dfireblastxc3 : int
var dfireblastyc3 : int
var dfireblastxc4 : int
var dfireblastyc4 : int
randint (dfireblastx,1,600)
randint (dfireblasty,80,200)
randint (dfireblastxc1,1,600)
randint (dfireblastyc1,80,200)
randint (dfireblastxc2,1,600)
randint (dfireblastyc2,80,200)
randint (dfireblastxc3,1,600)
randint (dfireblastyc3,80,200)
randint (dfireblastxc4,1,600)
randint (dfireblastyc4,80,200)
var dfireblastshape : int := 30
var gravity : int := 20
var ground : int := 36
var jump : int := 200

% Game Over
var dark_mario_game_over : int := Pic.FileNew ("Testing/Game Test/Dark-Mario-World-Mario.jpg")

% Game Title Variables
var game_title : int := Pic.FileNew ("Testing/Game Control and Menu/Screen.jpg")

% Won Variable
var mario_won : int := Pic.FileNew ("Testing/Mario Won/Mario Won.jpg")

% Story Variables
var evil_mario_quest : int := Pic.FileNew ("Testing/Game Story/Evil Mario Quest.jpg")

% Final Stage Variables

var evil_mario_transformation_0 : int := Pic.FileNew ("Testing/Game Story/Dark Mario Transformation/0.jpg")
var evil_mario_transformation_1 : int := Pic.FileNew ("Testing/Game Story/Dark Mario Transformation/1.jpg")
var evil_mario_transformation_2 : int := Pic.FileNew ("Testing/Game Story/Dark Mario Transformation/2.jpg")
var evil_mario_transformation_3 : int := Pic.FileNew ("Testing/Game Story/Dark Mario Transformation/3.jpg")
var evil_mario_transformation_4 : int := Pic.FileNew ("Testing/Game Story/Dark Mario Transformation/4.jpg")
var evil_mario_transformation_5 : int := Pic.FileNew ("Testing/Game Story/Dark Mario Transformation/5.jpg")
var evil_mario_transformation_6 : int := Pic.FileNew ("Testing/Game Story/Dark Mario Transformation/6.jpg")

% Buttons Variables

var credit_to_me : int

% End Of Variables

% All Procedures

% Credit To Me

procedure credit
Music.PlayFileLoop ("Testing/Music/Full Steam Ahead.mp3")
% Credit
drawfillbox (1,1,1000,1000,7)
infont:=Font.New("Times New Romen:30")
Draw.Text("CREDIT", 300,520,infont,0)
Draw.Text("CREDIT", 300,519,infont,22)

% Status
infont:=Font.New("Times New Romen:14")
Draw.Text("Hello Everybody! I'm the developer of this game. My name is Shivang. My class", 30,490,infont,0)
Draw.Text("Hello Everybody! I'm the developer of this game. My name is Shivang. My class", 29,489,infont,22)
Draw.Text("is GVSS_Tajalli _ ICS2O. This program was completed on December 29, 2014.", 30,470,infont,0)
Draw.Text("is GVSS_Tajalli _ ICS2O. This program was completed on December 29, 2014.", 29,469,infont,22)
Draw.Text("You can refer to me as Master-Awesome or Special Cinema. I programmed ", 30,450,infont,0)
Draw.Text("You can refer to me as Master-Awesome or Special Cinema. I programmed ", 29,449,infont,22)
Draw.Text("this game. It wasn't easy. The characters and backgrounds are found from", 30,430,infont,0)
Draw.Text("this game. It wasn't easy. The characters and backgrounds are found from", 29,429,infont,22)
Draw.Text("Google images. The jump effect comes from gravity as without it, the", 30,410,infont,0)
Draw.Text("Google images. The jump effect comes from gravity as without it, the", 29,409,infont,22)
Draw.Text("character would just float. The landing comes from collision because without", 30,390,infont,0)
Draw.Text("character would just float. The landing comes from collision because without", 29,389,infont,22)
Draw.Text("something to stop the gravity, the character will just fall into the ground. The", 30,370,infont,0)
Draw.Text("something to stop the gravity, the character will just fall into the ground. The", 29,369,infont,22)
Draw.Text("purple energy balls come from collisions as well. Collision is just something ", 30,350,infont,0)
Draw.Text("purple energy balls come from collisions as well. Collision is just something ", 29,349,infont,22)
Draw.Text("that allows two objects to hit. I can't explain it, but you can find out more at:", 30,330,infont,0)
Draw.Text("that allows two objects to hit. I can't explain it, but you can find out more at:", 29,329,infont,22)
Draw.Text("http://compsci.ca/v3/viewtopic.php?t=13661. The music I found from Youtube.", 30,310,infont,0)
Draw.Text("http://compsci.ca/v3/viewtopic.php?t=13661. The music I found from Youtube.", 29,309,infont,22)
Draw.Text("Just type in \"Super Smash Bros. Wii U All Soundtracks\" and you will find them.", 30,290,infont,0)
Draw.Text("Just type in \"Super Smash Bros. Wii U All Soundtracks\" and you will find them.", 29,289,infont,22)
Draw.Text("Now that everything is cleared up, I'd like to warn you about an error that doesn't", 30,270,infont,0)
Draw.Text("Now that everything is cleared up, I'd like to warn you about an error that doesn't", 29,269,infont,22)
Draw.Text("affect me. Whenever I apply: loop", 30,250,infont,0)
Draw.Text("affect me. Whenever I apply: loop", 29,249,infont,22)
Draw.Text("exit when GUI.ProcessEvent", 320,230,infont,0)
Draw.Text("exit when GUI.ProcessEvent", 319,229,infont,22)
Draw.Text("end loop", 280,210,infont,0)
Draw.Text("end loop ", 279,209,infont,22)
Draw.Text("There's this screen that pops up saying WidgetModule.tu for the buttons. This", 30,190,infont,0)
Draw.Text("There's this screen that pops up saying WidgetModule.tu for the buttons. This", 29,189,infont,22)
Draw.Text("is not an error because of me, but rather Turing itself. Because the software", 30,170,infont,0)
Draw.Text("is not an error because of me, but rather Turing itself. Because the software", 29,169,infont,22)
Draw.Text("of Windows is newer, Turing is not use to that. In order to fix, you need to", 30,150,infont,0)
Draw.Text("of Windows is newer, Turing is not use to that. In order to fix, you need to", 29,149,infont,22)
Draw.Text("install and rearrange certain things on your computer. This maybe fixed in", 30,130,infont,0)
Draw.Text("install and rearrange certain things on your computer. This maybe fixed in", 29,129,infont,22)
Draw.Text("Turing 4.1.2 whenever that releases with the bugs fixed and all. Now I say:", 30,110,infont,0)
Draw.Text("Turing 4.1.2 whenever that releases with the bugs fixed and all. Now I say:", 29,109,infont,22)
infont:=Font.New("Times New Romen:27")
Draw.Text("THANK YOU FOR PLAYING MY GAME!", 33,60,infont,0)
Draw.Text("THANK YOU FOR PLAYING MY GAME!", 32,59,infont,2)
infont:=Font.New("Times New Romen:12")
Draw.Text("PLEASE GO TO CODING WINDOW AND PRESS \"Run\", IF YOU WANT TO PLAY AGAIN!", 40,30,infont,0)
Draw.Text("PLEASE GO TO CODING WINDOW AND PRESS \"Run\", IF YOU WANT TO PLAY AGAIN!", 39,29,infont,22)
end credit

% When Player Loses
procedure game_over
Music.PlayFileLoop ("Testing/Music/The Grand Finale (Bowser's Inside Story).mp3")
drawfillbox (1,1,1000,1000,7)
picID:= dark_mario_game_over
Pic.Draw (picID,70,20,picCopy)
end game_over

% When Player Wins
procedure won
% Control Pictures and Text
cls
Music.PlayFileLoop ("Testing/Music/Super Mario World Medley.mp3")
drawfillbox (1,1,1000,1000,119)
picID:= mario_won
Pic.Draw (picID,40,60,picCopy)

% Control Title
infont:=Font.New("Times New Romen:26")
Draw.Text("YOU HAVE RECLAIMED THE KINGDOM!", 30,520,infont,0)
Draw.Text("YOU HAVE RECLAIMED THE KINGDOM!", 29,519,infont,4)
% Buttons
credit_to_me := GUI.CreateButton (290,470,0, "SEE WHO MADE IT",credit)
% Button Press (The Source Of The Stupid Code That Pops Up Right After
% You Close The Program Because Of The Version Of Windows Being The
% Latest Which I Hope Turing Fixes In 4.1.2)
loop
exit when GUI.ProcessEvent
end loop

end won

% Game
procedure background

% Background
drawfillbox (1,1,1000,1000,7)
picID:= Pic.FileNew ("Testing/Game Test/Dark-Castle.jpg")
Pic.Draw (picID,215,370,picCopy)
colourback (20)
locate (35,1)
put ""
colourback (20)
locate (36,1)
put ""
drawfillbox (1,34,720,360,7)

% Mario
drawfillbox (x,y,720,200,7)
picID:= Pic.FileNew ("Testing/Game Test/Mario/Mario Walking Original/Walking-Mario-1.jpg")

% Display Lives
% Mario Lives
colour (0)
colourback (7)
locate (2,8)
put "Mario = ",mlives
picID:= Pic.FileNew ("Testing/Game Test/Mario/Icon/Mario-icon.jpg")
Pic.Draw (picID,20,400,picCopy)

% Dark Mario Lives
colour (0)
locate (2,70)
put "Dark Mario = ",dmlives
picID:= Pic.FileNew ("Testing/Game Test/Dark Mario/Icon/Mario-icon.jpg")
Pic.Draw (picID,540,400,picCopy)

end background

% Fly Background

procedure fly_background

% Fly Background
drawfillbox (1,1,1000,1000,7)
picID:= Pic.FileNew ("Testing/Game Test/orion.jpg")
Pic.Draw (picID,1,1,picCopy)

% Display Mario Flying Right
picID := mario_flies_right1
Pic.Draw (picID,mfx,mfy,picCopy)

% Dark Mario Left Original
picID := dark_mario_flies_left1
Pic.Draw (picID,600,200,picCopy)
delay (50)
picID := dark_mario_flies_left2
Pic.Draw (picID,600,200,picCopy)
delay (50)
picID := dark_mario_flies_left3
Pic.Draw (picID,600,200,picCopy)
delay (50)

% Display Lives
% Mario Lives
colour (0)
colourback (7)
locate (2,8)
put "Mario = ",mlives
picID:= Pic.FileNew ("Testing/Game Test/Mario/Icon/Mario-icon.jpg")
Pic.Draw (picID,20,400,picCopy)

% Dark Mario Lives
colour (0)
locate (2,70)
put "Dark Mario = ",dmlives
picID:= Pic.FileNew ("Testing/Game Test/Dark Mario/Icon/Mario-icon.jpg")
Pic.Draw (picID,540,400,picCopy)

% Display The Stage
picID:= animation6
Pic.Draw (picID,190,400,picCopy)

% Fire Movement
colour (41)
locate (13,36)
put "Fire Movement = ",fire_movement

end fly_background

procedure mario_death
Music.PlayFileLoop ("Testing/Music/Sound Effects/Fire Burning Sound Effect.mp3")
delay (100)
picID := f0
Pic.Draw (picID,mfx,mfy,picCopy)
delay (100)
picID := f1
Pic.Draw (picID,mfx,mfy,picCopy)
delay (100)
picID := f2
Pic.Draw (picID,mfx,mfy,picCopy)
delay (100)
picID := f3
Pic.Draw (picID,mfx,mfy,picCopy)
delay (100)
picID := f4
Pic.Draw (picID,mfx,mfy,picCopy)
delay (100)
picID := f5
Pic.Draw (picID,mfx,mfy,picCopy)
delay (100)
picID := f6
Pic.Draw (picID,mfx,mfy,picCopy)
delay (100)
picID := f7
Pic.Draw (picID,mfx,mfy,picCopy)
delay (100)
picID := f8
Pic.Draw (picID,mfx,mfy,picCopy)
delay (100)
picID := f9
Pic.Draw (picID,mfx,mfy,picCopy)
delay (100)
picID := f10
Pic.Draw (picID,mfx,mfy,picCopy)
delay (100)
picID := f11
Pic.Draw (picID,mfx,mfy,picCopy)
delay (100)
Music.PlayFileLoop ("Testing/Music/Fortress Boss (Super Mario World).mp3")
end mario_death

procedure dark_mario
% The Random Dark Mario Effect
randint (dmfx,180,580)
randint (dmfy,40,200)
randint (dmfxc1,180,580)
randint (dmfyc1,40,200)
randint (dmfxc2,180,580)
randint (dmfyc2,40,200)
randint (dmfxc3,180,580)
randint (dmfyc3,40,200)
randint (dmfxc4,180,580)
randint (dmfyc4,40,200)
% Dark Blast Point Original
drawfilloval (dmfx,dmfy,fly_dfireblastshape,fly_dfireblastshape,7)
drawfilloval (dmfx,dmfy,fly_dfireblastshape,fly_dfireblastshape,105)
delay (20)

% Dark Blast Point Clone1
drawfilloval (dmfxc1,dmfyc1,fly_dfireblastshape,fly_dfireblastshape,7)
drawfilloval (dmfxc1,dmfyc1,fly_dfireblastshape,fly_dfireblastshape,105)
delay (20)

% Dark Blast Point Clone2
drawfilloval (dmfxc2,dmfyc2,fly_dfireblastshape,fly_dfireblastshape,7)
drawfilloval (dmfxc2,dmfyc2,fly_dfireblastshape,fly_dfireblastshape,105)
delay (20)

% Dark Blast Point Clone3
drawfilloval (dmfxc3,dmfyc3,fly_dfireblastshape,fly_dfireblastshape,7)
drawfilloval (dmfxc3,dmfyc3,fly_dfireblastshape,fly_dfireblastshape,105)
delay (20)

% Dark Blast Point Clone4
drawfilloval (dmfxc4,dmfyc4,fly_dfireblastshape,fly_dfireblastshape,7)
drawfilloval (dmfxc4,dmfyc4,fly_dfireblastshape,fly_dfireblastshape,105)
delay (20)
end dark_mario

procedure sky_battle
Music.PlayFileLoop ("Testing/Music/Fortress Boss (Super Mario World).mp3")
fly_background
dark_mario
loop % For Game
loop % For Background
getch (key2)
if ord (key2) = 200 and mfy < sky_limity1 then % Up
mfy := mfy + 20
delay (50)
picID := mario_flies_right1
Pic.Draw (picID,mfx,mfy,picCopy)
delay (50)
picID := mario_flies_right2
Pic.Draw (picID,mfx,mfy,picCopy)
delay (50)
picID := mario_flies_right3
Pic.Draw (picID,mfx,mfy,picCopy)
elsif ord (key2) = 205 and mfx < sky_limitx1 then % Right
mfx := mfx + 20
delay (50)
picID := mario_flies_right1
Pic.Draw (picID,mfx,mfy,picCopy)
delay (50)
picID := mario_flies_right2
Pic.Draw (picID,mfx,mfy,picCopy)
delay (50)
picID := mario_flies_right3
Pic.Draw (picID,mfx,mfy,picCopy)
elsif ord (key2) = 203 and mfx > sky_limitx2 then % Left
mfx := mfx - 20
delay (50)
picID := mario_flies_left1
Pic.Draw (picID,mfx,mfy,picCopy)
delay (50)
picID := mario_flies_left2
Pic.Draw (picID,mfx,mfy,picCopy)
delay (50)
picID := mario_flies_left3
Pic.Draw (picID,mfx,mfy,picCopy)
elsif ord (key2) = 208 and mfy > sky_limity2 then % Down
mfy := mfy - 20
delay (50)
picID := mario_flies_left1
Pic.Draw (picID,mfx,mfy,picCopy)
delay (50)
picID := mario_flies_left2
Pic.Draw (picID,mfx,mfy,picCopy)
delay (50)
picID := mario_flies_left3
Pic.Draw (picID,mfx,mfy,picCopy)
elsif ord (key2) = 32 then % Space Make Blast Appear
drawfilloval (fly_fireblastx,fly_fireblasty,fly_fireblastshape,fly_fireblastshape,7)
fly_fireblastx := 360
fly_fireblasty := 200
drawfilloval (fly_fireblastx,fly_fireblasty,fly_fireblastshape,fly_fireblastshape,41)
elsif ord (key2) = 100 and fly_fireblastx < bsky_limitx1 then % D Move Blast Right
% Fire Movement Count Down
fire_movement := fire_movement - 1
colour (41)
locate (13,36)
put "Fire Movement = ",fire_movement
% Fire Movement
drawfilloval (fly_fireblastx,fly_fireblasty,fly_fireblastshape,fly_fireblastshape,7)
fly_fireblastx := fly_fireblastx+20
drawfilloval (fly_fireblastx,fly_fireblasty,fly_fireblastshape,fly_fireblastshape,41)
elsif ord (key2) = 97 and fly_fireblastx > bsky_limitx2 then % A Move Blast Left
% Fire Movement Count Down
fire_movement := fire_movement - 1
colour (41)
locate (13,36)
put "Fire Movement = ",fire_movement
% Fire Movement
drawfilloval (fly_fireblastx,fly_fireblasty,fly_fireblastshape,fly_fireblastshape,7)
fly_fireblastx := fly_fireblastx-20
drawfilloval (fly_fireblastx,fly_fireblasty,fly_fireblastshape,fly_fireblastshape,41)
elsif ord (key2) = 115 and fly_fireblasty > bsky_limity2 then % S Move Blast Down
% Fire Movement Count Down
fire_movement := fire_movement - 1
colour (41)
locate (13,36)
put "Fire Movement = ",fire_movement
% Fire Movement
drawfilloval (fly_fireblastx,fly_fireblasty,fly_fireblastshape,fly_fireblastshape,7)
fly_fireblasty := fly_fireblasty-20
drawfilloval (fly_fireblastx,fly_fireblasty,fly_fireblastshape,fly_fireblastshape,41)
elsif ord (key2) = 119 and fly_fireblasty < bsky_limity1 then % W Move Blast Up
% Fire Movement Count Down
fire_movement := fire_movement - 1
colour (41)
locate (13,36)
put "Fire Movement = ",fire_movement
% Fire Movement
drawfilloval (fly_fireblastx,fly_fireblasty,fly_fireblastshape,fly_fireblastshape,7)
fly_fireblasty := fly_fireblasty+20
drawfilloval (fly_fireblastx,fly_fireblasty,fly_fireblastshape,fly_fireblastshape,41)
end if
% Mario Sky Lives
if fire_movement <= 0 then
mlives := mlives - 1
mario_death
cls
fly_fireblastx := 360
fly_fireblasty := 200
fire_movement := 40
fly_background
dark_mario
end if

% Dark Mario Sky Lives
% Calculate The Blasts Dark Mario Kill
dmkill := sqrt ((dmfx-fly_fireblastx)**2 + (dmfy-fly_fireblasty)**2)
if dmkill <= fly_fireblastshape + fly_dfireblastshape then
dmlives := dmlives - 2
cls
fly_fireblastx := 360
fly_fireblasty := 200
fire_movement := 40
fly_background
dark_mario
end if
% Wrong Blast 1
mkill1 := sqrt ((dmfxc1-fly_fireblastx)**2 + (dmfyc1-fly_fireblasty)**2)
if mkill1 <= fly_fireblastshape + fly_dfireblastshape then
mlives := mlives - 1
cls
fly_fireblastx := 360
fly_fireblasty := 200
fire_movement := 40
fly_background
dark_mario
end if
% Mario Gain Life
mgain := sqrt ((dmfxc2-fly_fireblastx)**2 + (dmfyc2-fly_fireblasty)**2)
if mgain <= fly_fireblastshape + fly_dfireblastshape then
mlives := mlives + 3
cls
fly_fireblastx := 360
fly_fireblasty := 200
fire_movement := 40
fly_background
dark_mario
end if
% Dark Mario Gain Life
dmgain := sqrt ((dmfxc3-fly_fireblastx)**2 + (dmfyc3-fly_fireblasty)**2)
if dmgain <= fly_fireblastshape + fly_dfireblastshape then
dmlives := dmlives + 1
cls
fly_fireblastx := 360
fly_fireblasty := 200
fire_movement := 40
fly_background
dark_mario
end if
% Wrong Blast 2
mkill2 := sqrt ((dmfxc4-fly_fireblastx)**2 + (dmfyc4-fly_fireblasty)**2)
if mkill2 <= fly_fireblastshape + fly_dfireblastshape then
mlives := mlives - 2
cls
fly_fireblastx := 360
fly_fireblasty := 200
fire_movement := 40
fly_background
dark_mario
end if
% Winning
if dmlives <= 0 then
cls
won
end if
% Losing
if mlives <= 0 then
cls
game_over

% Buttons
var see_credit : int := GUI.CreateButton (310,400,0, "Game Over See Credit",credit)
% Button Press (The Source Of The Stupid Code That Pops Up Right After
% You Close The Program Because Of The Version Of Windows Being The
% Latest Which I Hope Turing Fixes In 4.1.2)
loop
exit when GUI.ProcessEvent
end loop

end if
% Display The Stage
picID:= animation0
Pic.Draw (picID,190,400,picCopy)
delay (25)
picID:= animation1
Pic.Draw (picID,190,400,picCopy)
delay (25)
picID:= animation2
Pic.Draw (picID,190,400,picCopy)
delay (25)
picID:= animation3
Pic.Draw (picID,190,400,picCopy)
delay (25)
picID:= animation4
Pic.Draw (picID,190,400,picCopy)
delay (25)
picID:= animation5
Pic.Draw (picID,190,400,picCopy)
delay (25)
picID:= animation6
Pic.Draw (picID,190,400,picCopy)
delay (25)
end loop % Background Ends
end loop % Game Ends
end sky_battle

% Final Stage Begins

procedure final_stage_begins
Music.PlayFileLoop ("Testing/Music/Fated Battle.mp3")
% Final Stage Title
drawfill (20,20,7,7)
infont:=Font.New("Times New Romen:30")
Draw.Text("DARK MARIO FINAL STAGE", 100,520,infont,0)
Draw.Text("DARK MARIO FINAL STAGE", 99,519,infont,4)

% Story Of Stage
infont:=Font.New("Times New Romen:12")
Draw.Text("OH YOU HAVE REALLY DONE IT NOW! DARK MARIO HAS GONE SUPER! PREPARE YOURSELF!", 2,50,infont,0)
Draw.Text("OH YOU HAVE REALLY DONE IT NOW! DARK MARIO HAS GONE SUPER! PREPARE YOURSELF!", 1,49,infont,4)
Draw.Text("GOAL: THERE ARE 5 PURPLE BLASTS! 2 WILL TAKE YOUR LIFE AWAY! 1 WILL GIVE YOU LIFE!", 2,30,infont,0)
Draw.Text("GOAL: THERE ARE 5 PURPLE BLASTS! 2 WILL TAKE YOUR LIFE AWAY! 1 WILL GIVE YOU LIFE!", 1,29,infont,4)
Draw.Text("1 WILL GIVE DARK MARIO A LIFE! 1 TAKES AWAY DARK MARIO'S LIFE! GOOD LUCK!", 2,10,infont,0)
Draw.Text("1 WILL GIVE DARK MARIO A LIFE! 1 TAKES AWAY DARK MARIO'S LIFE! GOOD LUCK!", 1,9,infont,4)

% Dark Mario Transformation
loop
picID:= evil_mario_transformation_0
Pic.Draw (picID,100,120,picCopy)
delay (20)
picID:= evil_mario_transformation_1
Pic.Draw (picID,100,120,picCopy)
delay (20)
picID:= evil_mario_transformation_2
Pic.Draw (picID,100,120,picCopy)
delay (20)
picID:= evil_mario_transformation_3
Pic.Draw (picID,100,120,picCopy)
delay (20)
picID:= evil_mario_transformation_4
Pic.Draw (picID,100,120,picCopy)
delay (20)
picID:= evil_mario_transformation_5
Pic.Draw (picID,100,120,picCopy)
delay (20)
picID:= evil_mario_transformation_6
Pic.Draw (picID,100,120,picCopy)
delay (20)
% Buttons
var sky_game_begin : int := GUI.CreateButton (310,80,0, "Start Game",sky_battle)
% Button Press (The Source Of The Stupid Code That Pops Up Right After
% You Close The Program Because Of The Version Of Windows Being The
% Latest Which I Hope Turing Fixes In 4.1.2)
exit when GUI.ProcessEvent
end loop

end final_stage_begins

procedure game
% Original Game
Music.PlayFileLoop ("Testing/Music/Tough Guy Alert!.mp3")
background
drawfillbox (1,34,720,360,7)
loop
getch (key1)
if ord (key1) = 205 then % right
% Controls
drawfillbox (x,y,xm,ym,7)
x := x + 40
picID:= mario_walks_right2
Pic.Draw (picID,x,y,picCopy)
delay (40)
picID:= mario_walks_right3
Pic.Draw (picID,x,y,picCopy)
delay (40)
picID:= mario_walks_right1
Pic.Draw (picID,x,y,picCopy)
delay (40)
% Dark Mario
drawfillbox (dx,dy,dxm,dym,7)
randint (dx,1,600)
picID:= dark_mario_walks_left2
Pic.Draw (picID,dx,dy,picCopy)
delay (40)
picID:= dark_mario_walks_left3
Pic.Draw (picID,dx,dy,picCopy)
delay (40)
picID:= dark_mario_walks_left1
Pic.Draw (picID,dx,dy,picCopy)
delay (40)
elsif ord (key1) = 203 then % left
% Controls
drawfillbox (x,y,xm,ym,7)
x := x - 40
picID:= mario_walks_left2
Pic.Draw (picID,x,y,picCopy)
delay (40)
picID:= mario_walks_left3
Pic.Draw (picID,x,y,picCopy)
delay (40)
picID:= mario_walks_left1
Pic.Draw (picID,x,y,picCopy)
% Dark Mario
drawfillbox (dx,dy,dxm,dym,7)
randint (dx,1,600)
picID:= dark_mario_walks_left2
Pic.Draw (picID,dx,dy,picCopy)
delay (40)
picID:= dark_mario_walks_left3
Pic.Draw (picID,dx,dy,picCopy)
delay (40)
picID:= dark_mario_walks_left1
Pic.Draw (picID,dx,dy,picCopy)
delay (40)
elsif ord (key1) = 32 then % Space To Shoot
drawfilloval (fireblastx,fireblasty,fireblastshape,fireblastshape,7)
fireblastx := fireblastx - 10
drawfilloval (fireblastx,fireblasty,fireblastshape,fireblastshape,41)
% Controls
drawfillbox (x,y,xm,ym,7)
% Apply Gravity For Character Fall
y -= gravity
if y < ground then
y := ground
end if
picID:= mario_walks_right1
Pic.Draw (picID,x,y,picCopy)
delay (40)
elsif ord (key1) = 208 then % Down To Reset Shoot Position
drawfilloval (fireblastx,fireblasty,fireblastshape,fireblastshape,7)
fireblastx := 600
drawfilloval (fireblastx,fireblasty,fireblastshape,fireblastshape,41)
elsif ord (key1) = 200 and y = ground then % Up To Jump
Music.PlayFileLoop ("Testing/Music/Sound Effects/Maro Jump Sound Effect.mp3")
% Controls
drawfillbox (x,y,xm,ym,7)
y := jump
% Controls
drawfillbox (x,y,xm,ym,7)
x := x + 40
picID:= mario_walks_right2
Pic.Draw (picID,x,y,picCopy)
delay (40)
picID:= mario_walks_right3
Pic.Draw (picID,x,y,picCopy)
delay (40)
picID:= mario_walks_right1
Pic.Draw (picID,x,y,picCopy)
delay (40)
% Dark Mario
drawfillbox (dx,dy,dxm,dym,7)
randint (dx,1,600)
picID:= dark_mario_walks_left2
Pic.Draw (picID,dx,dy,picCopy)
delay (40)
picID:= dark_mario_walks_left3
Pic.Draw (picID,dx,dy,picCopy)
delay (40)
picID:= dark_mario_walks_left1
Pic.Draw (picID,dx,dy,picCopy)
delay (300)
Music.PlayFileLoop ("Testing/Music/Tough Guy Alert!.mp3")
end if

% Display Fire Blast
drawfilloval (fireblastx,fireblasty,fireblastshape,fireblastshape,7)
fireblastx := fireblastx - 10
drawfilloval (fireblastx,fireblasty,fireblastshape,fireblastshape,41)

% Apply Gravity For Character Fall
y -= gravity
if y < ground then
y := ground
end if

% Lives
if fireblastx < dx then
dmlives := dmlives -1
delay (20)
cls
background
fireblastx := 600
end if
% Next Stage
if dmlives <= 6 then
% Dark Mario Blasting Ability
randint (dfireblastx,1,600)
randint (dfireblasty,80,200)
randint (dfireblastxc1,1,600)
randint (dfireblastyc1,80,200)
randint (dfireblastxc2,1,600)
randint (dfireblastyc2,80,200)
randint (dfireblastxc3,1,600)
randint (dfireblastyc3,80,200)
randint (dfireblastxc4,1,600)
randint (dfireblastyc4,80,200)
cls
background
drawfilloval (dfireblastx,dfireblasty,dfireblastshape,dfireblastshape,7)
drawfilloval (dfireblastx,dfireblasty,dfireblastshape,dfireblastshape,105)
delay (20)
drawfilloval (dfireblastxc1,dfireblastyc1,dfireblastshape,dfireblastshape,7)
drawfilloval (dfireblastxc1,dfireblastyc1,dfireblastshape,dfireblastshape,105)
delay (20)
drawfilloval (dfireblastxc2,dfireblastyc2,dfireblastshape,dfireblastshape,7)
drawfilloval (dfireblastxc2,dfireblastyc2,dfireblastshape,dfireblastshape,105)
delay (20)
drawfilloval (dfireblastxc3,dfireblastyc3,dfireblastshape,dfireblastshape,7)
drawfilloval (dfireblastxc3,dfireblastyc3,dfireblastshape,dfireblastshape,105)
delay (20)
drawfilloval (dfireblastxc4,dfireblastyc4,dfireblastshape,dfireblastshape,7)
drawfilloval (dfireblastxc4,dfireblastyc4,dfireblastshape,dfireblastshape,105)
delay (20)
end if
% Lose A Life
if x = dfireblastx and dmlives <= 6 then
mlives := mlives - 1
cls
background
end if

if x = dfireblastxc1 and dmlives <= 6 then
mlives := mlives - 1
cls
background
end if

if x = dfireblastxc2 and dmlives <= 6 then
mlives := mlives - 1
cls
background
end if

if x = dfireblastxc3 and dmlives <= 6 then
mlives := mlives - 1
cls
background
end if

if x = dfireblastxc4 and dmlives <= 6 then
mlives := mlives - 1
cls
background
end if

% Final Up Stage
if dmlives <= 3 then
cls
final_stage_begins
end if
% Game Over
if mlives <= 0 then
cls
game_over
% Buttons
var see_credit : int := GUI.CreateButton (310,400,0, "Game Over See Credit",credit)
% Button Press (The Source Of The Stupid Code That Pops Up Right After
% You Close The Program Because Of The Version Of Windows Being The
% Latest Which I Hope Turing Fixes In 4.1.2)
loop
exit when GUI.ProcessEvent
end loop

end if
end loop
end game

procedure mario_quest
% Quest Background
cls
Music.PlayFileLoop ("Testing/Music/Gerudo Valley (Remix).mp3")
drawfill (20,20,7,7)
picID:= evil_mario_quest
Pic.Draw (picID,1,1,picCopy)

% Quest Title
infont:=Font.New("Times New Romen:30")
Draw.Text("DARK MARIO QUEST", 170,520,infont,0)
Draw.Text("DARK MARIO QUEST", 169,519,infont,180)

% Story
infont:=Font.New("Times New Romen:14")
Draw.Text("It was just a nice day till an evil person arrived from another ", 140,440,infont,0)
Draw.Text("It was just a nice day till an evil person arrived from another ", 139,439,infont,180)
Draw.Text("dimension. He claimed his name was Mario and he had ruled", 166,420,infont,0)
Draw.Text("dimension. He claimed his name was Mario and he had ruled", 165,419,infont,180)
Draw.Text("infinite Mushroom Kingdoms and always people fought back", 166,400,infont,0)
Draw.Text("infinite Mushroom Kingdoms and always people fought back", 165,399,infont,180)
Draw.Text("and never won. Even his own dimensional twins were no match.", 161,380,infont,0)
Draw.Text("and never won. Even his own dimensional twins were no match.", 160,379,infont,180)
Draw.Text("He offered to spare this world's people, if they surrenderred", 161,360,infont,0)
Draw.Text("He offered to spare this world's people, if they surrenderred", 160,359,infont,180)
Draw.Text("their kingdom. Of course the king, Toadsworth, said no. Dark", 161,340,infont,0)
Draw.Text("their kingdom. Of course the king, Toadsworth, said no. Dark", 160,339,infont,180)
Draw.Text("Mario, as what people called him, threw everybody out of the", 164,320,infont,0)
Draw.Text("Mario, as what people called him, threw everybody out of the", 163,319,infont,180)
Draw.Text("castle and claimed it for himself, the kingdom. Whoever was", 165,300,infont,0)
Draw.Text("castle and claimed it for himself, the kingdom. Whoever was", 164,299,infont,180)
Draw.Text("left got enslaved by Dark Mario. When Mario returned after his", 171,280,infont,0)
Draw.Text("left got enslaved by Dark Mario. When Mario returned after his", 170,279,infont,180)
Draw.Text("left got enslaved by Dark Mario. When Mario returned after his", 171,280,infont,0)
Draw.Text("left got enslaved by Dark Mario. When Mario returned after his", 170,279,infont,180)
Draw.Text("stroll with the princess, they found the castle transformed.", 179,260,infont,0)
Draw.Text("stroll with the princess, they found the castle transformed.", 178,259,infont,180)
Draw.Text("Everybody was looking sad and miserable. Toadsworth", 188,240,infont,0)
Draw.Text("Everybody was looking sad and miserable. Toadsworth", 187,239,infont,180)
Draw.Text("begged Mario to help reclaim his kingdom. Mario said, \"Yes!\"", 198,220,infont,0)
Draw.Text("begged Mario to help reclaim his kingdom. Mario said, \"Yes!\"", 197,219,infont,180)
Draw.Text("and asked who's responsible for this. Mario was shocked to", 208,200,infont,0)
Draw.Text("and asked who's responsible for this. Mario was shocked to", 207,199,infont,180)
Draw.Text("find it was himself and not his enemy Bowser. Mario jumped", 218,180,infont,0)
Draw.Text("find it was himself and not his enemy Bowser. Mario jumped", 217,179,infont,180)
Draw.Text("into the castle and challenged Dark Mario to a fight. Dark", 229,160,infont,0)
Draw.Text("into the castle and challenged Dark Mario to a fight. Dark", 228,159,infont,180)
Draw.Text("Mario laughed and accepted Mario's challenge. Now the", 240,140,infont,0)
Draw.Text("Mario laughed and accepted Mario's challenge. Now the", 239,139,infont,180)
Draw.Text("battle is on. Do you accept?", 260,120,infont,0)
Draw.Text("battle is on. Do you accept?", 259,119,infont,180)
% Buttons
var game_begin : int := GUI.CreateButton (380,50,0, "Start Game",game)
% Button Press (The Source Of The Stupid Code That Pops Up Right After
% You Close The Program Because Of The Version Of Windows Being The
% Latest Which I Hope Turing Fixes In 4.1.2)
loop
exit when GUI.ProcessEvent
end loop

end mario_quest

% Instructions On How To Play

procedure keyboard1_see_again
cls
% Control Pictures and Text
GUI.SetBackgroundColour (119)
picID:= keyboard_controls1
Pic.Draw (picID,40,60,picCopy)

% Control Title
infont:=Font.New("Times New Romen:30")
Draw.Text("CONTROLS FOR FIRST STAGE!", 60,520,infont,0)
Draw.Text("CONTROLS FOR FIRST STAGE!", 59,519,infont,4)

% Controls
infont:=Font.New("Times New Romen:18")
Draw.Text("Up Arrow Key-Jump!", 60,480,infont,0)
Draw.Text("Up Arrow Key-Jump!", 59,479,infont,4)
Draw.Text("Right Arrow Key-Walk Right!", 60,450,infont,0)
Draw.Text("Right Arrow Key-Walk Right!", 59,449,infont,4)
Draw.Text("Left Arrow Key-Walk Left!", 60,420,infont,0)
Draw.Text("Left Arrow Key-Walk Left!", 59,419,infont,4)
Draw.Text("Down Arrow Key-To Reset Fire Blast!", 60,390,infont,0)
Draw.Text("Down Arrow Key-To Reset Fire Blast!", 59,389,infont,4)
Draw.Text("Spacebar-To Shoot Fire Blast!", 60,360,infont,0)
Draw.Text("Spacebar-To Shoot Fire Blast!", 59,359,infont,4)
Draw.Text("Goal: You must shoot Dark Mario 6 times for him to die!", 60,330,infont,0)
Draw.Text("Goal: You must shoot Dark Mario 6 times for him to die!", 59,329,infont,4)
Draw.Text("Difficulty: Easy", 60,300,infont,0)
Draw.Text("Difficulty: Easy", 59,299,infont,4)
% Buttons
var play_game : int := GUI.CreateButton (610,20,0, "PLAY",mario_quest)
% Button Press (The Source Of The Stupid Code That Pops Up Right After
% You Close The Program Because Of The Version Of Windows Being The
% Latest Which I Hope Turing Fixes In 4.1.2)
loop
exit when GUI.ProcessEvent
end loop

end keyboard1_see_again

procedure keyboard2
drawfill (20,20,7,7)
picID:= keyboard_controls2
Pic.Draw (picID,40,60,picCopy)

% Control Title
infont:=Font.New("Times New Romen:30")
Draw.Text("CONTROLS FOR SECOND STAGE!", 30,520,infont,0)
Draw.Text("CONTROLS FOR SECOND STAGE!", 29,519,infont,180)

% Controls
infont:=Font.New("Times New Romen:18")
Draw.Text("W-Move Blast Up!", 60,480,infont,0)
Draw.Text("W-Move Blast Up!", 59,479,infont,180)
Draw.Text("D-Move Blast Right!", 60,450,infont,0)
Draw.Text("D-Move Blast Right!", 59,449,infont,180)
Draw.Text("A-Move Blast Left!", 60,420,infont,0)
Draw.Text("A-Move Blast Left!", 59,419,infont,180)
Draw.Text("S-Move Blast Down!", 60,390,infont,0)
Draw.Text("S-Move Blast Down!", 59,389,infont,180)
Draw.Text("Spacebar-To Reset Fireblast!", 60,360,infont,0)
Draw.Text("Spacebar-To Reset Fireblast!", 59,359,infont,180)
infont:=Font.New("Times New Romen:14")
Draw.Text("Goal: Dark Mario has 3 lives and they're 5 purple fireblasts. Only one contains ", 60,335,infont,0)
Draw.Text("Goal: Dark Mario has 3 lives and they're 5 purple fireblasts. Only one contains ", 59,334,infont,180)
Draw.Text("Dark Mario's life! You can only move your blast 40 times before you burn up!", 60,315,infont,0)
Draw.Text("Dark Mario's life! You can only move your blast 40 times before you burn up!", 59,314,infont,180)
Draw.Text("Difficulty: Hard because the other four fireblasts are filled with surpries!", 60,295,infont,0)
Draw.Text("Difficulty: Hard because the other four fireblasts are filled with surpries!", 59,294,infont,180)
% Buttons
var keyboardcontrols1 : int := GUI.CreateButton (40,20,0, "First Stage Controls",keyboard1_see_again)
var play_game : int := GUI.CreateButton (610,20,0, "PLAY",mario_quest)
% Button Press (The Source Of The Stupid Code That Pops Up Right After
% You Close The Program Because Of The Version Of Windows Being The
% Latest Which I Hope Turing Fixes In 4.1.2)
loop
exit when GUI.ProcessEvent
end loop

end keyboard2

procedure keyboard1
cls
Music.PlayFileLoop ("Testing/Music/Super Mario Bros. 3 Medley.mp3")
% Control Pictures and Text
GUI.SetBackgroundColour (119)
picID:= keyboard_controls1
Pic.Draw (picID,40,60,picCopy)

% Control Title
infont:=Font.New("Times New Romen:30")
Draw.Text("CONTROLS FOR FIRST STAGE!", 60,520,infont,0)
Draw.Text("CONTROLS FOR FIRST STAGE!", 59,519,infont,4)

% Controls
infont:=Font.New("Times New Romen:18")
Draw.Text("Up Arrow Key-Jump!", 60,480,infont,0)
Draw.Text("Up Arrow Key-Jump!", 59,479,infont,4)
Draw.Text("Right Arrow Key-Walk Right!", 60,450,infont,0)
Draw.Text("Right Arrow Key-Walk Right!", 59,449,infont,4)
Draw.Text("Left Arrow Key-Walk Left!", 60,420,infont,0)
Draw.Text("Left Arrow Key-Walk Left!", 59,419,infont,4)
Draw.Text("Down Arrow Key-To Reset Fire Blast!", 60,390,infont,0)
Draw.Text("Down Arrow Key-To Reset Fire Blast!", 59,389,infont,4)
Draw.Text("Spacebar-To Shoot Fire Blast!", 60,360,infont,0)
Draw.Text("Spacebar-To Shoot Fire Blast!", 59,359,infont,4)
Draw.Text("Goal: You must shoot Dark Mario 6 times for him to die!", 60,330,infont,0)
Draw.Text("Goal: You must shoot Dark Mario 6 times for him to die!", 59,329,infont,4)
Draw.Text("Difficulty: Easy", 60,300,infont,0)
Draw.Text("Difficulty: Easy", 59,299,infont,4)
% Buttons
var keyboardcontrols1 : int := GUI.CreateButton (300,20,0, "Second Stage Controls",keyboard2)
% Button Press (The Source Of The Stupid Code That Pops Up Right After
% You Close The Program Because Of The Version Of Windows Being The
% Latest Which I Hope Turing Fixes In 4.1.2)
loop
exit when GUI.ProcessEvent
end loop

end keyboard1

% Game Menu
procedure title
cls
Music.PlayFileLoop ("Testing/Music/Ground Theme & Underground Theme.mp3")
% Pictures and Text
drawfill (20,20,114,114)
picID:= game_title
Pic.Draw (picID,40,40,picCopy)
infont:=Font.New("Times New Romen:40")
Draw.Text("MARIO VS. DARK MARIO",50,500,infont,0)
Draw.Text("MARIO ",51,499,infont,4)
Draw.Text (" VS.",58,499,infont,105)
Draw.Text(" DARK MARIO",53,499,infont,180)
% Buttons
var play_game : int := GUI.CreateButton (330,240,0, "PLAY",mario_quest)
var controls : int := GUI.CreateButton (310,210,0, "CONTROLS",keyboard1)
credit_to_me := GUI.CreateButton (323,180,0, "CREDIT",credit)
% Button Press (The Source Of The Stupid Code That Pops Up Right After
% You Close The Program Because Of The Version Of Windows Being The
% Latest Which I Hope Turing Fixes In 4.1.2)
loop
exit when GUI.ProcessEvent
end loop

end title
title
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Mon Jan 05, 2015 5:44 pm   Post subject: RE:I Need Help With Gui Buttons! Whenever I Apply, There Is This Glitch Where In Next Procedure Buttons Are Still There!

How do you ever exit your many
code:

loop
exit when GUI.ProcessEvent
end loop

loops?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
master-awesome




PostPosted: Mon Jan 05, 2015 6:21 pm   Post subject: Re: I Need Help With Gui Buttons! Whenever I Apply, There Is This Glitch Where In Next Procedure Buttons Are Still There

Each exit loops are of different procedures!

Quote:
% Name: Master-Awesome
% Updated Date: 12/29/2014
import GUI
View.Set ("graphics:720;580")
var picID : int

% All Gaming Variables

% Keyboard Variable
var infont : int
var keyboard_controls1 : int := Pic.FileNew ("Testing/Game Control and Menu/Keyboard 1.jpg")
var keyboard_controls2 : int := Pic.FileNew ("Testing/Game Control and Menu/Keyboard 2.jpg")

% Flying Declare Variables
var mfx : int := 1
var mfy : int := 200
var dmfx : int
var dmfy : int
var dmfxc1 : int
var dmfyc1 : int
var dmfxc2 : int
var dmfyc2 : int
var dmfxc3 : int
var dmfyc3 : int
var dmfxc4 : int
var dmfyc4 : int
var sky_limit : int := 300
var fly_fireblastx : int := 360
var fly_fireblasty : int := 200
var fly_fireblastshape : int := 30
var fly_dfireblastshape : int := 30
var fire_movement : int := 40
var dmkill : real
var mkill1 : real
var mkill2 : real
var mgain : real
var dmgain : real

% Blast Bounderies
var bsky_limity1 : int := 200
var bsky_limity2 : int := 40
var bsky_limitx1 : int :=580
var bsky_limitx2 : int := 180

% Mario Boundery
var sky_limity1 : int := 240
var sky_limity2 : int := 230
var sky_limitx1 : int := 20
var sky_limitx2 : int := 1

% Mario Flies To The Right
var mario_flies_right1 : int := Pic.FileNew ("Testing/Game Test/Mario/Mario Flying Original/Mario-Flying-1.jpg")
var mario_flies_right2 : int := Pic.FileNew ("Testing/Game Test/Mario/Mario Flying Original/Mario-Flying-2.jpg")
var mario_flies_right3 : int := Pic.FileNew ("Testing/Game Test/Mario/Mario Flying Original/Mario-Flying-3.jpg")

% Mario Flies To The Left
var mario_flies_left1 : int := Pic.FileNew ("Testing/Game Test/Mario/Mario Flying Opposite Direction/Mario-Flying-Opposite-Direction-1.jpg")
var mario_flies_left2 : int := Pic.FileNew ("Testing/Game Test/Mario/Mario Flying Opposite Direction/Mario-Flying-Opposite-Direction-2.jpg")
var mario_flies_left3 : int := Pic.FileNew ("Testing/Game Test/Mario/Mario Flying Opposite Direction/Mario-Flying-Opposite-Direction-3.jpg")

% Dark Mario Flies To The Left
var dark_mario_flies_left1 : int := Pic.FileNew ("Testing/Game Test/Dark Mario/Mario Flying Opposite Direction/Mario-Flying-Opposite-Direction-1.jpg")
var dark_mario_flies_left2 : int := Pic.FileNew ("Testing/Game Test/Dark Mario/Mario Flying Opposite Direction/Mario-Flying-Opposite-Direction-2.jpg")
var dark_mario_flies_left3 : int := Pic.FileNew ("Testing/Game Test/Dark Mario/Mario Flying Opposite Direction/Mario-Flying-Opposite-Direction-3.jpg")

% Background Animation
var animation0 : int := Pic.FileNew ("Testing/Game Test/The Sky Battle Stage/0.jpg")
var animation1 : int := Pic.FileNew ("Testing/Game Test/The Sky Battle Stage/1.jpg")
var animation2 : int := Pic.FileNew ("Testing/Game Test/The Sky Battle Stage/2.jpg")
var animation3 : int := Pic.FileNew ("Testing/Game Test/The Sky Battle Stage/3.jpg")
var animation4 : int := Pic.FileNew ("Testing/Game Test/The Sky Battle Stage/4.jpg")
var animation5 : int := Pic.FileNew ("Testing/Game Test/The Sky Battle Stage/5.jpg")
var animation6 : int := Pic.FileNew ("Testing/Game Test/The Sky Battle Stage/6.jpg")

% Background Animation
var f0 : int := Pic.FileNew ("Testing/Game Test/Mario's Death/0.jpg")
var f1 : int := Pic.FileNew ("Testing/Game Test/Mario's Death/1.jpg")
var f2 : int := Pic.FileNew ("Testing/Game Test/Mario's Death/2.jpg")
var f3 : int := Pic.FileNew ("Testing/Game Test/Mario's Death/3.jpg")
var f4 : int := Pic.FileNew ("Testing/Game Test/Mario's Death/4.jpg")
var f5 : int := Pic.FileNew ("Testing/Game Test/Mario's Death/5.jpg")
var f6 : int := Pic.FileNew ("Testing/Game Test/Mario's Death/6.jpg")
var f7 : int := Pic.FileNew ("Testing/Game Test/Mario's Death/7.jpg")
var f8 : int := Pic.FileNew ("Testing/Game Test/Mario's Death/8.jpg")
var f9 : int := Pic.FileNew ("Testing/Game Test/Mario's Death/9.jpg")
var f10 : int := Pic.FileNew ("Testing/Game Test/Mario's Death/10.jpg")
var f11 : int := Pic.FileNew ("Testing/Game Test/Mario's Death/11.jpg")

% Mario Walking Right
var mario_walks_right2 : int := Pic.FileNew ("Testing/Game Test/Mario/Mario Walking Original/Walking-Mario-2.jpg")
var mario_walks_right3 : int := Pic.FileNew ("Testing/Game Test/Mario/Mario Walking Original/Walking-Mario-3.jpg")
var mario_walks_right1 : int := Pic.FileNew ("Testing/Game Test/Mario/Mario Walking Original/Walking-Mario-1.jpg")

% Mario Walking Left
var mario_walks_left2 : int := Pic.FileNew ("Testing/Game Test/Mario/Mario Walking Opposite Direction/Mario-Walking-Opposite-Direction-2.jpg")
var mario_walks_left3 : int := Pic.FileNew ("Testing/Game Test/Mario/Mario Walking Opposite Direction/Mario-Walking-Opposite-Direction-3.jpg")
var mario_walks_left1 : int := Pic.FileNew ("Testing/Game Test/Mario/Mario Walking Opposite Direction/Mario-Walking-Opposite-Direction-1.jpg")

% Dark Mario Waling Left
var dark_mario_walks_left2 : int := Pic.FileNew ("Testing/Game Test/Dark Mario/Mario Walking Opposite Direction/Mario-Walking-Opposite-Direction-2.jpg")
var dark_mario_walks_left3 : int := Pic.FileNew ("Testing/Game Test/Dark Mario/Mario Walking Opposite Direction/Mario-Walking-Opposite-Direction-3.jpg")
var dark_mario_walks_left1 : int := Pic.FileNew ("Testing/Game Test/Dark Mario/Mario Walking Opposite Direction/Mario-Walking-Opposite-Direction-1.jpg")

% Declare Variables
var x : int := 1
var y : int := 36
var dx : int := 600
var dy : int := 36
var xm : int := 720
var ym : int := 360
var dxm : int := 720
var dym : int := 200
var key1 : string (1)
var key2 : string (1)
var mlives : int := 3
var dmlives : int := 9
var fireblastx : int := 600
var fireblasty : int := 80
var fireblastshape : int := 30
var dfireblastx : int
var dfireblasty : int
var dfireblastxc1 : int
var dfireblastyc1 : int
var dfireblastxc2 : int
var dfireblastyc2 : int
var dfireblastxc3 : int
var dfireblastyc3 : int
var dfireblastxc4 : int
var dfireblastyc4 : int
randint (dfireblastx,1,600)
randint (dfireblasty,80,200)
randint (dfireblastxc1,1,600)
randint (dfireblastyc1,80,200)
randint (dfireblastxc2,1,600)
randint (dfireblastyc2,80,200)
randint (dfireblastxc3,1,600)
randint (dfireblastyc3,80,200)
randint (dfireblastxc4,1,600)
randint (dfireblastyc4,80,200)
var dfireblastshape : int := 30
var gravity : int := 20
var ground : int := 36
var jump : int := 200

% Game Over
var dark_mario_game_over : int := Pic.FileNew ("Testing/Game Test/Dark-Mario-World-Mario.jpg")

% Game Title Variables
var game_title : int := Pic.FileNew ("Testing/Game Control and Menu/Screen.jpg")

% Won Variable
var mario_won : int := Pic.FileNew ("Testing/Mario Won/Mario Won.jpg")

% Story Variables
var evil_mario_quest : int := Pic.FileNew ("Testing/Game Story/Evil Mario Quest.jpg")

% Final Stage Variables

var evil_mario_transformation_0 : int := Pic.FileNew ("Testing/Game Story/Dark Mario Transformation/0.jpg")
var evil_mario_transformation_1 : int := Pic.FileNew ("Testing/Game Story/Dark Mario Transformation/1.jpg")
var evil_mario_transformation_2 : int := Pic.FileNew ("Testing/Game Story/Dark Mario Transformation/2.jpg")
var evil_mario_transformation_3 : int := Pic.FileNew ("Testing/Game Story/Dark Mario Transformation/3.jpg")
var evil_mario_transformation_4 : int := Pic.FileNew ("Testing/Game Story/Dark Mario Transformation/4.jpg")
var evil_mario_transformation_5 : int := Pic.FileNew ("Testing/Game Story/Dark Mario Transformation/5.jpg")
var evil_mario_transformation_6 : int := Pic.FileNew ("Testing/Game Story/Dark Mario Transformation/6.jpg")

% Buttons Variables

var credit_to_me : int

% End Of Variables

% All Procedures

% Credit To Me

procedure credit
Music.PlayFileLoop ("Testing/Music/Full Steam Ahead.mp3")
% Credit
drawfillbox (1,1,1000,1000,7)
infont:=Font.New("Times New Romen:30")
Draw.Text("CREDIT", 300,520,infont,0)
Draw.Text("CREDIT", 300,519,infont,22)

% Status
infont:=Font.New("Times New Romen:14")
Draw.Text("Hello Everybody! I'm the developer of this game. My name is Shivang. My class", 30,490,infont,0)
Draw.Text("Hello Everybody! I'm the developer of this game. My name is Shivang. My class", 29,489,infont,22)
Draw.Text("is GVSS_Tajalli _ ICS2O. This program was completed on December 29, 2014.", 30,470,infont,0)
Draw.Text("is GVSS_Tajalli _ ICS2O. This program was completed on December 29, 2014.", 29,469,infont,22)
Draw.Text("You can refer to me as Master-Awesome or Special Cinema. I programmed ", 30,450,infont,0)
Draw.Text("You can refer to me as Master-Awesome or Special Cinema. I programmed ", 29,449,infont,22)
Draw.Text("this game. It wasn't easy. The characters and backgrounds are found from", 30,430,infont,0)
Draw.Text("this game. It wasn't easy. The characters and backgrounds are found from", 29,429,infont,22)
Draw.Text("Google images. The jump effect comes from gravity as without it, the", 30,410,infont,0)
Draw.Text("Google images. The jump effect comes from gravity as without it, the", 29,409,infont,22)
Draw.Text("character would just float. The landing comes from collision because without", 30,390,infont,0)
Draw.Text("character would just float. The landing comes from collision because without", 29,389,infont,22)
Draw.Text("something to stop the gravity, the character will just fall into the ground. The", 30,370,infont,0)
Draw.Text("something to stop the gravity, the character will just fall into the ground. The", 29,369,infont,22)
Draw.Text("purple energy balls come from collisions as well. Collision is just something ", 30,350,infont,0)
Draw.Text("purple energy balls come from collisions as well. Collision is just something ", 29,349,infont,22)
Draw.Text("that allows two objects to hit. I can't explain it, but you can find out more at:", 30,330,infont,0)
Draw.Text("that allows two objects to hit. I can't explain it, but you can find out more at:", 29,329,infont,22)
Draw.Text("http://compsci.ca/v3/viewtopic.php?t=13661. The music I found from Youtube.", 30,310,infont,0)
Draw.Text("http://compsci.ca/v3/viewtopic.php?t=13661. The music I found from Youtube.", 29,309,infont,22)
Draw.Text("Just type in \"Super Smash Bros. Wii U All Soundtracks\" and you will find them.", 30,290,infont,0)
Draw.Text("Just type in \"Super Smash Bros. Wii U All Soundtracks\" and you will find them.", 29,289,infont,22)
Draw.Text("Now that everything is cleared up, I'd like to warn you about an error that doesn't", 30,270,infont,0)
Draw.Text("Now that everything is cleared up, I'd like to warn you about an error that doesn't", 29,269,infont,22)
Draw.Text("affect me. Whenever I apply: loop", 30,250,infont,0)
Draw.Text("affect me. Whenever I apply: loop", 29,249,infont,22)
Draw.Text("exit when GUI.ProcessEvent", 320,230,infont,0)
Draw.Text("exit when GUI.ProcessEvent", 319,229,infont,22)
Draw.Text("end loop", 280,210,infont,0)
Draw.Text("end loop ", 279,209,infont,22)
Draw.Text("There's this screen that pops up saying WidgetModule.tu for the buttons. This", 30,190,infont,0)
Draw.Text("There's this screen that pops up saying WidgetModule.tu for the buttons. This", 29,189,infont,22)
Draw.Text("is not an error because of me, but rather Turing itself. Because the software", 30,170,infont,0)
Draw.Text("is not an error because of me, but rather Turing itself. Because the software", 29,169,infont,22)
Draw.Text("of Windows is newer, Turing is not use to that. In order to fix, you need to", 30,150,infont,0)
Draw.Text("of Windows is newer, Turing is not use to that. In order to fix, you need to", 29,149,infont,22)
Draw.Text("install and rearrange certain things on your computer. This maybe fixed in", 30,130,infont,0)
Draw.Text("install and rearrange certain things on your computer. This maybe fixed in", 29,129,infont,22)
Draw.Text("Turing 4.1.2 whenever that releases with the bugs fixed and all. Now I say:", 30,110,infont,0)
Draw.Text("Turing 4.1.2 whenever that releases with the bugs fixed and all. Now I say:", 29,109,infont,22)
infont:=Font.New("Times New Romen:27")
Draw.Text("THANK YOU FOR PLAYING MY GAME!", 33,60,infont,0)
Draw.Text("THANK YOU FOR PLAYING MY GAME!", 32,59,infont,2)
infont:=Font.New("Times New Romen:12")
Draw.Text("PLEASE GO TO CODING WINDOW AND PRESS \"Run\", IF YOU WANT TO PLAY AGAIN!", 40,30,infont,0)
Draw.Text("PLEASE GO TO CODING WINDOW AND PRESS \"Run\", IF YOU WANT TO PLAY AGAIN!", 39,29,infont,22)
end credit

% When Player Loses
procedure game_over
Music.PlayFileLoop ("Testing/Music/The Grand Finale (Bowser's Inside Story).mp3")
drawfillbox (1,1,1000,1000,7)
picID:= dark_mario_game_over
Pic.Draw (picID,70,20,picCopy)
end game_over

% When Player Wins
procedure won
% Control Pictures and Text
cls
Music.PlayFileLoop ("Testing/Music/Super Mario World Medley.mp3")
drawfillbox (1,1,1000,1000,119)
picID:= mario_won
Pic.Draw (picID,40,60,picCopy)

% Control Title
infont:=Font.New("Times New Romen:26")
Draw.Text("YOU HAVE RECLAIMED THE KINGDOM!", 30,520,infont,0)
Draw.Text("YOU HAVE RECLAIMED THE KINGDOM!", 29,519,infont,4)
% Buttons
credit_to_me := GUI.CreateButton (290,470,0, "SEE WHO MADE IT",credit)
% Button Press (The Source Of The Stupid Code That Pops Up Right After
% You Close The Program Because Of The Version Of Windows Being The
% Latest Which I Hope Turing Fixes In 4.1.2)
loop
exit when GUI.ProcessEvent
end loop
end won


% Game
procedure background

% Background
drawfillbox (1,1,1000,1000,7)
picID:= Pic.FileNew ("Testing/Game Test/Dark-Castle.jpg")
Pic.Draw (picID,215,370,picCopy)
colourback (20)
locate (35,1)
put ""
colourback (20)
locate (36,1)
put ""
drawfillbox (1,34,720,360,7)

% Mario
drawfillbox (x,y,720,200,7)
picID:= Pic.FileNew ("Testing/Game Test/Mario/Mario Walking Original/Walking-Mario-1.jpg")

% Display Lives
% Mario Lives
colour (0)
colourback (7)
locate (2,8)
put "Mario = ",mlives
picID:= Pic.FileNew ("Testing/Game Test/Mario/Icon/Mario-icon.jpg")
Pic.Draw (picID,20,400,picCopy)

% Dark Mario Lives
colour (0)
locate (2,70)
put "Dark Mario = ",dmlives
picID:= Pic.FileNew ("Testing/Game Test/Dark Mario/Icon/Mario-icon.jpg")
Pic.Draw (picID,540,400,picCopy)

end background

% Fly Background

procedure fly_background

% Fly Background
drawfillbox (1,1,1000,1000,7)
picID:= Pic.FileNew ("Testing/Game Test/orion.jpg")
Pic.Draw (picID,1,1,picCopy)

% Display Mario Flying Right
picID := mario_flies_right1
Pic.Draw (picID,mfx,mfy,picCopy)

% Dark Mario Left Original
picID := dark_mario_flies_left1
Pic.Draw (picID,600,200,picCopy)
delay (50)
picID := dark_mario_flies_left2
Pic.Draw (picID,600,200,picCopy)
delay (50)
picID := dark_mario_flies_left3
Pic.Draw (picID,600,200,picCopy)
delay (50)

% Display Lives
% Mario Lives
colour (0)
colourback (7)
locate (2,8)
put "Mario = ",mlives
picID:= Pic.FileNew ("Testing/Game Test/Mario/Icon/Mario-icon.jpg")
Pic.Draw (picID,20,400,picCopy)

% Dark Mario Lives
colour (0)
locate (2,70)
put "Dark Mario = ",dmlives
picID:= Pic.FileNew ("Testing/Game Test/Dark Mario/Icon/Mario-icon.jpg")
Pic.Draw (picID,540,400,picCopy)

% Display The Stage
picID:= animation6
Pic.Draw (picID,190,400,picCopy)

% Fire Movement
colour (41)
locate (13,36)
put "Fire Movement = ",fire_movement

end fly_background

procedure mario_death
Music.PlayFileLoop ("Testing/Music/Sound Effects/Fire Burning Sound Effect.mp3")
delay (100)
picID := f0
Pic.Draw (picID,mfx,mfy,picCopy)
delay (100)
picID := f1
Pic.Draw (picID,mfx,mfy,picCopy)
delay (100)
picID := f2
Pic.Draw (picID,mfx,mfy,picCopy)
delay (100)
picID := f3
Pic.Draw (picID,mfx,mfy,picCopy)
delay (100)
picID := f4
Pic.Draw (picID,mfx,mfy,picCopy)
delay (100)
picID := f5
Pic.Draw (picID,mfx,mfy,picCopy)
delay (100)
picID := f6
Pic.Draw (picID,mfx,mfy,picCopy)
delay (100)
picID := f7
Pic.Draw (picID,mfx,mfy,picCopy)
delay (100)
picID := f8
Pic.Draw (picID,mfx,mfy,picCopy)
delay (100)
picID := f9
Pic.Draw (picID,mfx,mfy,picCopy)
delay (100)
picID := f10
Pic.Draw (picID,mfx,mfy,picCopy)
delay (100)
picID := f11
Pic.Draw (picID,mfx,mfy,picCopy)
delay (100)
Music.PlayFileLoop ("Testing/Music/Fortress Boss (Super Mario World).mp3")
end mario_death

procedure dark_mario
% The Random Dark Mario Effect
randint (dmfx,180,580)
randint (dmfy,40,200)
randint (dmfxc1,180,580)
randint (dmfyc1,40,200)
randint (dmfxc2,180,580)
randint (dmfyc2,40,200)
randint (dmfxc3,180,580)
randint (dmfyc3,40,200)
randint (dmfxc4,180,580)
randint (dmfyc4,40,200)
% Dark Blast Point Original
drawfilloval (dmfx,dmfy,fly_dfireblastshape,fly_dfireblastshape,7)
drawfilloval (dmfx,dmfy,fly_dfireblastshape,fly_dfireblastshape,105)
delay (20)

% Dark Blast Point Clone1
drawfilloval (dmfxc1,dmfyc1,fly_dfireblastshape,fly_dfireblastshape,7)
drawfilloval (dmfxc1,dmfyc1,fly_dfireblastshape,fly_dfireblastshape,105)
delay (20)

% Dark Blast Point Clone2
drawfilloval (dmfxc2,dmfyc2,fly_dfireblastshape,fly_dfireblastshape,7)
drawfilloval (dmfxc2,dmfyc2,fly_dfireblastshape,fly_dfireblastshape,105)
delay (20)

% Dark Blast Point Clone3
drawfilloval (dmfxc3,dmfyc3,fly_dfireblastshape,fly_dfireblastshape,7)
drawfilloval (dmfxc3,dmfyc3,fly_dfireblastshape,fly_dfireblastshape,105)
delay (20)

% Dark Blast Point Clone4
drawfilloval (dmfxc4,dmfyc4,fly_dfireblastshape,fly_dfireblastshape,7)
drawfilloval (dmfxc4,dmfyc4,fly_dfireblastshape,fly_dfireblastshape,105)
delay (20)
end dark_mario

procedure sky_battle
Music.PlayFileLoop ("Testing/Music/Fortress Boss (Super Mario World).mp3")
fly_background
dark_mario
loop % For Game
loop % For Background
getch (key2)
if ord (key2) = 200 and mfy < sky_limity1 then % Up
mfy := mfy + 20
delay (50)
picID := mario_flies_right1
Pic.Draw (picID,mfx,mfy,picCopy)
delay (50)
picID := mario_flies_right2
Pic.Draw (picID,mfx,mfy,picCopy)
delay (50)
picID := mario_flies_right3
Pic.Draw (picID,mfx,mfy,picCopy)
elsif ord (key2) = 205 and mfx < sky_limitx1 then % Right
mfx := mfx + 20
delay (50)
picID := mario_flies_right1
Pic.Draw (picID,mfx,mfy,picCopy)
delay (50)
picID := mario_flies_right2
Pic.Draw (picID,mfx,mfy,picCopy)
delay (50)
picID := mario_flies_right3
Pic.Draw (picID,mfx,mfy,picCopy)
elsif ord (key2) = 203 and mfx > sky_limitx2 then % Left
mfx := mfx - 20
delay (50)
picID := mario_flies_left1
Pic.Draw (picID,mfx,mfy,picCopy)
delay (50)
picID := mario_flies_left2
Pic.Draw (picID,mfx,mfy,picCopy)
delay (50)
picID := mario_flies_left3
Pic.Draw (picID,mfx,mfy,picCopy)
elsif ord (key2) = 208 and mfy > sky_limity2 then % Down
mfy := mfy - 20
delay (50)
picID := mario_flies_left1
Pic.Draw (picID,mfx,mfy,picCopy)
delay (50)
picID := mario_flies_left2
Pic.Draw (picID,mfx,mfy,picCopy)
delay (50)
picID := mario_flies_left3
Pic.Draw (picID,mfx,mfy,picCopy)
elsif ord (key2) = 32 then % Space Make Blast Appear
drawfilloval (fly_fireblastx,fly_fireblasty,fly_fireblastshape,fly_fireblastshape,7)
fly_fireblastx := 360
fly_fireblasty := 200
drawfilloval (fly_fireblastx,fly_fireblasty,fly_fireblastshape,fly_fireblastshape,41)
elsif ord (key2) = 100 and fly_fireblastx < bsky_limitx1 then % D Move Blast Right
% Fire Movement Count Down
fire_movement := fire_movement - 1
colour (41)
locate (13,36)
put "Fire Movement = ",fire_movement
% Fire Movement
drawfilloval (fly_fireblastx,fly_fireblasty,fly_fireblastshape,fly_fireblastshape,7)
fly_fireblastx := fly_fireblastx+20
drawfilloval (fly_fireblastx,fly_fireblasty,fly_fireblastshape,fly_fireblastshape,41)
elsif ord (key2) = 97 and fly_fireblastx > bsky_limitx2 then % A Move Blast Left
% Fire Movement Count Down
fire_movement := fire_movement - 1
colour (41)
locate (13,36)
put "Fire Movement = ",fire_movement
% Fire Movement
drawfilloval (fly_fireblastx,fly_fireblasty,fly_fireblastshape,fly_fireblastshape,7)
fly_fireblastx := fly_fireblastx-20
drawfilloval (fly_fireblastx,fly_fireblasty,fly_fireblastshape,fly_fireblastshape,41)
elsif ord (key2) = 115 and fly_fireblasty > bsky_limity2 then % S Move Blast Down
% Fire Movement Count Down
fire_movement := fire_movement - 1
colour (41)
locate (13,36)
put "Fire Movement = ",fire_movement
% Fire Movement
drawfilloval (fly_fireblastx,fly_fireblasty,fly_fireblastshape,fly_fireblastshape,7)
fly_fireblasty := fly_fireblasty-20
drawfilloval (fly_fireblastx,fly_fireblasty,fly_fireblastshape,fly_fireblastshape,41)
elsif ord (key2) = 119 and fly_fireblasty < bsky_limity1 then % W Move Blast Up
% Fire Movement Count Down
fire_movement := fire_movement - 1
colour (41)
locate (13,36)
put "Fire Movement = ",fire_movement
% Fire Movement
drawfilloval (fly_fireblastx,fly_fireblasty,fly_fireblastshape,fly_fireblastshape,7)
fly_fireblasty := fly_fireblasty+20
drawfilloval (fly_fireblastx,fly_fireblasty,fly_fireblastshape,fly_fireblastshape,41)
end if
% Mario Sky Lives
if fire_movement <= 0 then
mlives := mlives - 1
mario_death
cls
fly_fireblastx := 360
fly_fireblasty := 200
fire_movement := 40
fly_background
dark_mario
end if

% Dark Mario Sky Lives
% Calculate The Blasts Dark Mario Kill
dmkill := sqrt ((dmfx-fly_fireblastx)**2 + (dmfy-fly_fireblasty)**2)
if dmkill <= fly_fireblastshape + fly_dfireblastshape then
dmlives := dmlives - 2
cls
fly_fireblastx := 360
fly_fireblasty := 200
fire_movement := 40
fly_background
dark_mario
end if
% Wrong Blast 1
mkill1 := sqrt ((dmfxc1-fly_fireblastx)**2 + (dmfyc1-fly_fireblasty)**2)
if mkill1 <= fly_fireblastshape + fly_dfireblastshape then
mlives := mlives - 1
cls
fly_fireblastx := 360
fly_fireblasty := 200
fire_movement := 40
fly_background
dark_mario
end if
% Mario Gain Life
mgain := sqrt ((dmfxc2-fly_fireblastx)**2 + (dmfyc2-fly_fireblasty)**2)
if mgain <= fly_fireblastshape + fly_dfireblastshape then
mlives := mlives + 3
cls
fly_fireblastx := 360
fly_fireblasty := 200
fire_movement := 40
fly_background
dark_mario
end if
% Dark Mario Gain Life
dmgain := sqrt ((dmfxc3-fly_fireblastx)**2 + (dmfyc3-fly_fireblasty)**2)
if dmgain <= fly_fireblastshape + fly_dfireblastshape then
dmlives := dmlives + 1
cls
fly_fireblastx := 360
fly_fireblasty := 200
fire_movement := 40
fly_background
dark_mario
end if
% Wrong Blast 2
mkill2 := sqrt ((dmfxc4-fly_fireblastx)**2 + (dmfyc4-fly_fireblasty)**2)
if mkill2 <= fly_fireblastshape + fly_dfireblastshape then
mlives := mlives - 2
cls
fly_fireblastx := 360
fly_fireblasty := 200
fire_movement := 40
fly_background
dark_mario
end if
% Winning
if dmlives <= 0 then
cls
won
end if
% Losing
if mlives <= 0 then
cls
game_over

% Buttons
var see_credit : int := GUI.CreateButton (310,400,0, "Game Over See Credit",credit)
% Button Press (The Source Of The Stupid Code That Pops Up Right After
% You Close The Program Because Of The Version Of Windows Being The
% Latest Which I Hope Turing Fixes In 4.1.2)
loop
exit when GUI.ProcessEvent
end loop
end if

% Display The Stage
picID:= animation0
Pic.Draw (picID,190,400,picCopy)
delay (25)
picID:= animation1
Pic.Draw (picID,190,400,picCopy)
delay (25)
picID:= animation2
Pic.Draw (picID,190,400,picCopy)
delay (25)
picID:= animation3
Pic.Draw (picID,190,400,picCopy)
delay (25)
picID:= animation4
Pic.Draw (picID,190,400,picCopy)
delay (25)
picID:= animation5
Pic.Draw (picID,190,400,picCopy)
delay (25)
picID:= animation6
Pic.Draw (picID,190,400,picCopy)
delay (25)
end loop % Background Ends
end loop % Game Ends
end sky_battle

% Final Stage Begins

procedure final_stage_begins
Music.PlayFileLoop ("Testing/Music/Fated Battle.mp3")
% Final Stage Title
drawfill (20,20,7,7)
infont:=Font.New("Times New Romen:30")
Draw.Text("DARK MARIO FINAL STAGE", 100,520,infont,0)
Draw.Text("DARK MARIO FINAL STAGE", 99,519,infont,4)

% Story Of Stage
infont:=Font.New("Times New Romen:12")
Draw.Text("OH YOU HAVE REALLY DONE IT NOW! DARK MARIO HAS GONE SUPER! PREPARE YOURSELF!", 2,50,infont,0)
Draw.Text("OH YOU HAVE REALLY DONE IT NOW! DARK MARIO HAS GONE SUPER! PREPARE YOURSELF!", 1,49,infont,4)
Draw.Text("GOAL: THERE ARE 5 PURPLE BLASTS! 2 WILL TAKE YOUR LIFE AWAY! 1 WILL GIVE YOU LIFE!", 2,30,infont,0)
Draw.Text("GOAL: THERE ARE 5 PURPLE BLASTS! 2 WILL TAKE YOUR LIFE AWAY! 1 WILL GIVE YOU LIFE!", 1,29,infont,4)
Draw.Text("1 WILL GIVE DARK MARIO A LIFE! 1 TAKES AWAY DARK MARIO'S LIFE! GOOD LUCK!", 2,10,infont,0)
Draw.Text("1 WILL GIVE DARK MARIO A LIFE! 1 TAKES AWAY DARK MARIO'S LIFE! GOOD LUCK!", 1,9,infont,4)

% Dark Mario Transformation
loop
picID:= evil_mario_transformation_0
Pic.Draw (picID,100,120,picCopy)
delay (20)
picID:= evil_mario_transformation_1
Pic.Draw (picID,100,120,picCopy)
delay (20)
picID:= evil_mario_transformation_2
Pic.Draw (picID,100,120,picCopy)
delay (20)
picID:= evil_mario_transformation_3
Pic.Draw (picID,100,120,picCopy)
delay (20)
picID:= evil_mario_transformation_4
Pic.Draw (picID,100,120,picCopy)
delay (20)
picID:= evil_mario_transformation_5
Pic.Draw (picID,100,120,picCopy)
delay (20)
picID:= evil_mario_transformation_6
Pic.Draw (picID,100,120,picCopy)
delay (20)
% Buttons
var sky_game_begin : int := GUI.CreateButton (310,80,0, "Start Game",sky_battle)
% Button Press (The Source Of The Stupid Code That Pops Up Right After
% You Close The Program Because Of The Version Of Windows Being The
% Latest Which I Hope Turing Fixes In 4.1.2)
exit when GUI.ProcessEvent
end loop
end final_stage_begins


procedure game
% Original Game
Music.PlayFileLoop ("Testing/Music/Tough Guy Alert!.mp3")
background
drawfillbox (1,34,720,360,7)
loop
getch (key1)
if ord (key1) = 205 then % right
% Controls
drawfillbox (x,y,xm,ym,7)
x := x + 40
picID:= mario_walks_right2
Pic.Draw (picID,x,y,picCopy)
delay (40)
picID:= mario_walks_right3
Pic.Draw (picID,x,y,picCopy)
delay (40)
picID:= mario_walks_right1
Pic.Draw (picID,x,y,picCopy)
delay (40)
% Dark Mario
drawfillbox (dx,dy,dxm,dym,7)
randint (dx,1,600)
picID:= dark_mario_walks_left2
Pic.Draw (picID,dx,dy,picCopy)
delay (40)
picID:= dark_mario_walks_left3
Pic.Draw (picID,dx,dy,picCopy)
delay (40)
picID:= dark_mario_walks_left1
Pic.Draw (picID,dx,dy,picCopy)
delay (40)
elsif ord (key1) = 203 then % left
% Controls
drawfillbox (x,y,xm,ym,7)
x := x - 40
picID:= mario_walks_left2
Pic.Draw (picID,x,y,picCopy)
delay (40)
picID:= mario_walks_left3
Pic.Draw (picID,x,y,picCopy)
delay (40)
picID:= mario_walks_left1
Pic.Draw (picID,x,y,picCopy)
% Dark Mario
drawfillbox (dx,dy,dxm,dym,7)
randint (dx,1,600)
picID:= dark_mario_walks_left2
Pic.Draw (picID,dx,dy,picCopy)
delay (40)
picID:= dark_mario_walks_left3
Pic.Draw (picID,dx,dy,picCopy)
delay (40)
picID:= dark_mario_walks_left1
Pic.Draw (picID,dx,dy,picCopy)
delay (40)
elsif ord (key1) = 32 then % Space To Shoot
drawfilloval (fireblastx,fireblasty,fireblastshape,fireblastshape,7)
fireblastx := fireblastx - 10
drawfilloval (fireblastx,fireblasty,fireblastshape,fireblastshape,41)
% Controls
drawfillbox (x,y,xm,ym,7)
% Apply Gravity For Character Fall
y -= gravity
if y < ground then
y := ground
end if
picID:= mario_walks_right1
Pic.Draw (picID,x,y,picCopy)
delay (40)
elsif ord (key1) = 208 then % Down To Reset Shoot Position
drawfilloval (fireblastx,fireblasty,fireblastshape,fireblastshape,7)
fireblastx := 600
drawfilloval (fireblastx,fireblasty,fireblastshape,fireblastshape,41)
elsif ord (key1) = 200 and y = ground then % Up To Jump
Music.PlayFileLoop ("Testing/Music/Sound Effects/Maro Jump Sound Effect.mp3")
% Controls
drawfillbox (x,y,xm,ym,7)
y := jump
% Controls
drawfillbox (x,y,xm,ym,7)
x := x + 40
picID:= mario_walks_right2
Pic.Draw (picID,x,y,picCopy)
delay (40)
picID:= mario_walks_right3
Pic.Draw (picID,x,y,picCopy)
delay (40)
picID:= mario_walks_right1
Pic.Draw (picID,x,y,picCopy)
delay (40)
% Dark Mario
drawfillbox (dx,dy,dxm,dym,7)
randint (dx,1,600)
picID:= dark_mario_walks_left2
Pic.Draw (picID,dx,dy,picCopy)
delay (40)
picID:= dark_mario_walks_left3
Pic.Draw (picID,dx,dy,picCopy)
delay (40)
picID:= dark_mario_walks_left1
Pic.Draw (picID,dx,dy,picCopy)
delay (300)
Music.PlayFileLoop ("Testing/Music/Tough Guy Alert!.mp3")
end if

% Display Fire Blast
drawfilloval (fireblastx,fireblasty,fireblastshape,fireblastshape,7)
fireblastx := fireblastx - 10
drawfilloval (fireblastx,fireblasty,fireblastshape,fireblastshape,41)

% Apply Gravity For Character Fall
y -= gravity
if y < ground then
y := ground
end if

% Lives
if fireblastx < dx then
dmlives := dmlives -1
delay (20)
cls
background
fireblastx := 600
end if
% Next Stage
if dmlives <= 6 then
% Dark Mario Blasting Ability
randint (dfireblastx,1,600)
randint (dfireblasty,80,200)
randint (dfireblastxc1,1,600)
randint (dfireblastyc1,80,200)
randint (dfireblastxc2,1,600)
randint (dfireblastyc2,80,200)
randint (dfireblastxc3,1,600)
randint (dfireblastyc3,80,200)
randint (dfireblastxc4,1,600)
randint (dfireblastyc4,80,200)
cls
background
drawfilloval (dfireblastx,dfireblasty,dfireblastshape,dfireblastshape,7)
drawfilloval (dfireblastx,dfireblasty,dfireblastshape,dfireblastshape,105)
delay (20)
drawfilloval (dfireblastxc1,dfireblastyc1,dfireblastshape,dfireblastshape,7)
drawfilloval (dfireblastxc1,dfireblastyc1,dfireblastshape,dfireblastshape,105)
delay (20)
drawfilloval (dfireblastxc2,dfireblastyc2,dfireblastshape,dfireblastshape,7)
drawfilloval (dfireblastxc2,dfireblastyc2,dfireblastshape,dfireblastshape,105)
delay (20)
drawfilloval (dfireblastxc3,dfireblastyc3,dfireblastshape,dfireblastshape,7)
drawfilloval (dfireblastxc3,dfireblastyc3,dfireblastshape,dfireblastshape,105)
delay (20)
drawfilloval (dfireblastxc4,dfireblastyc4,dfireblastshape,dfireblastshape,7)
drawfilloval (dfireblastxc4,dfireblastyc4,dfireblastshape,dfireblastshape,105)
delay (20)
end if
% Lose A Life
if x = dfireblastx and dmlives <= 6 then
mlives := mlives - 1
cls
background
end if

if x = dfireblastxc1 and dmlives <= 6 then
mlives := mlives - 1
cls
background
end if

if x = dfireblastxc2 and dmlives <= 6 then
mlives := mlives - 1
cls
background
end if

if x = dfireblastxc3 and dmlives <= 6 then
mlives := mlives - 1
cls
background
end if

if x = dfireblastxc4 and dmlives <= 6 then
mlives := mlives - 1
cls
background
end if

% Final Up Stage
if dmlives <= 3 then
cls
final_stage_begins
end if
% Game Over
if mlives <= 0 then
cls
game_over
% Buttons
var see_credit : int := GUI.CreateButton (310,400,0, "Game Over See Credit",credit)
% Button Press (The Source Of The Stupid Code That Pops Up Right After
% You Close The Program Because Of The Version Of Windows Being The
% Latest Which I Hope Turing Fixes In 4.1.2)
loop
exit when GUI.ProcessEvent
end loop
end if
end loop
end game


procedure mario_quest
% Quest Background
cls
Music.PlayFileLoop ("Testing/Music/Gerudo Valley (Remix).mp3")
drawfill (20,20,7,7)
picID:= evil_mario_quest
Pic.Draw (picID,1,1,picCopy)

% Quest Title
infont:=Font.New("Times New Romen:30")
Draw.Text("DARK MARIO QUEST", 170,520,infont,0)
Draw.Text("DARK MARIO QUEST", 169,519,infont,180)

% Story
infont:=Font.New("Times New Romen:14")
Draw.Text("It was just a nice day till an evil person arrived from another ", 140,440,infont,0)
Draw.Text("It was just a nice day till an evil person arrived from another ", 139,439,infont,180)
Draw.Text("dimension. He claimed his name was Mario and he had ruled", 166,420,infont,0)
Draw.Text("dimension. He claimed his name was Mario and he had ruled", 165,419,infont,180)
Draw.Text("infinite Mushroom Kingdoms and always people fought back", 166,400,infont,0)
Draw.Text("infinite Mushroom Kingdoms and always people fought back", 165,399,infont,180)
Draw.Text("and never won. Even his own dimensional twins were no match.", 161,380,infont,0)
Draw.Text("and never won. Even his own dimensional twins were no match.", 160,379,infont,180)
Draw.Text("He offered to spare this world's people, if they surrenderred", 161,360,infont,0)
Draw.Text("He offered to spare this world's people, if they surrenderred", 160,359,infont,180)
Draw.Text("their kingdom. Of course the king, Toadsworth, said no. Dark", 161,340,infont,0)
Draw.Text("their kingdom. Of course the king, Toadsworth, said no. Dark", 160,339,infont,180)
Draw.Text("Mario, as what people called him, threw everybody out of the", 164,320,infont,0)
Draw.Text("Mario, as what people called him, threw everybody out of the", 163,319,infont,180)
Draw.Text("castle and claimed it for himself, the kingdom. Whoever was", 165,300,infont,0)
Draw.Text("castle and claimed it for himself, the kingdom. Whoever was", 164,299,infont,180)
Draw.Text("left got enslaved by Dark Mario. When Mario returned after his", 171,280,infont,0)
Draw.Text("left got enslaved by Dark Mario. When Mario returned after his", 170,279,infont,180)
Draw.Text("left got enslaved by Dark Mario. When Mario returned after his", 171,280,infont,0)
Draw.Text("left got enslaved by Dark Mario. When Mario returned after his", 170,279,infont,180)
Draw.Text("stroll with the princess, they found the castle transformed.", 179,260,infont,0)
Draw.Text("stroll with the princess, they found the castle transformed.", 178,259,infont,180)
Draw.Text("Everybody was looking sad and miserable. Toadsworth", 188,240,infont,0)
Draw.Text("Everybody was looking sad and miserable. Toadsworth", 187,239,infont,180)
Draw.Text("begged Mario to help reclaim his kingdom. Mario said, \"Yes!\"", 198,220,infont,0)
Draw.Text("begged Mario to help reclaim his kingdom. Mario said, \"Yes!\"", 197,219,infont,180)
Draw.Text("and asked who's responsible for this. Mario was shocked to", 208,200,infont,0)
Draw.Text("and asked who's responsible for this. Mario was shocked to", 207,199,infont,180)
Draw.Text("find it was himself and not his enemy Bowser. Mario jumped", 218,180,infont,0)
Draw.Text("find it was himself and not his enemy Bowser. Mario jumped", 217,179,infont,180)
Draw.Text("into the castle and challenged Dark Mario to a fight. Dark", 229,160,infont,0)
Draw.Text("into the castle and challenged Dark Mario to a fight. Dark", 228,159,infont,180)
Draw.Text("Mario laughed and accepted Mario's challenge. Now the", 240,140,infont,0)
Draw.Text("Mario laughed and accepted Mario's challenge. Now the", 239,139,infont,180)
Draw.Text("battle is on. Do you accept?", 260,120,infont,0)
Draw.Text("battle is on. Do you accept?", 259,119,infont,180)
% Buttons
var game_begin : int := GUI.CreateButton (380,50,0, "Start Game",game)
% Button Press (The Source Of The Stupid Code That Pops Up Right After
% You Close The Program Because Of The Version Of Windows Being The
% Latest Which I Hope Turing Fixes In 4.1.2)
loop
exit when GUI.ProcessEvent
end loop
end mario_quest


% Instructions On How To Play

procedure keyboard1_see_again
cls
% Control Pictures and Text
GUI.SetBackgroundColour (119)
picID:= keyboard_controls1
Pic.Draw (picID,40,60,picCopy)

% Control Title
infont:=Font.New("Times New Romen:30")
Draw.Text("CONTROLS FOR FIRST STAGE!", 60,520,infont,0)
Draw.Text("CONTROLS FOR FIRST STAGE!", 59,519,infont,4)

% Controls
infont:=Font.New("Times New Romen:18")
Draw.Text("Up Arrow Key-Jump!", 60,480,infont,0)
Draw.Text("Up Arrow Key-Jump!", 59,479,infont,4)
Draw.Text("Right Arrow Key-Walk Right!", 60,450,infont,0)
Draw.Text("Right Arrow Key-Walk Right!", 59,449,infont,4)
Draw.Text("Left Arrow Key-Walk Left!", 60,420,infont,0)
Draw.Text("Left Arrow Key-Walk Left!", 59,419,infont,4)
Draw.Text("Down Arrow Key-To Reset Fire Blast!", 60,390,infont,0)
Draw.Text("Down Arrow Key-To Reset Fire Blast!", 59,389,infont,4)
Draw.Text("Spacebar-To Shoot Fire Blast!", 60,360,infont,0)
Draw.Text("Spacebar-To Shoot Fire Blast!", 59,359,infont,4)
Draw.Text("Goal: You must shoot Dark Mario 6 times for him to die!", 60,330,infont,0)
Draw.Text("Goal: You must shoot Dark Mario 6 times for him to die!", 59,329,infont,4)
Draw.Text("Difficulty: Easy", 60,300,infont,0)
Draw.Text("Difficulty: Easy", 59,299,infont,4)
% Buttons
var play_game : int := GUI.CreateButton (610,20,0, "PLAY",mario_quest)
% Button Press (The Source Of The Stupid Code That Pops Up Right After
% You Close The Program Because Of The Version Of Windows Being The
% Latest Which I Hope Turing Fixes In 4.1.2)
loop
exit when GUI.ProcessEvent
end loop
end keyboard1_see_again


procedure keyboard2
drawfill (20,20,7,7)
picID:= keyboard_controls2
Pic.Draw (picID,40,60,picCopy)

% Control Title
infont:=Font.New("Times New Romen:30")
Draw.Text("CONTROLS FOR SECOND STAGE!", 30,520,infont,0)
Draw.Text("CONTROLS FOR SECOND STAGE!", 29,519,infont,180)

% Controls
infont:=Font.New("Times New Romen:18")
Draw.Text("W-Move Blast Up!", 60,480,infont,0)
Draw.Text("W-Move Blast Up!", 59,479,infont,180)
Draw.Text("D-Move Blast Right!", 60,450,infont,0)
Draw.Text("D-Move Blast Right!", 59,449,infont,180)
Draw.Text("A-Move Blast Left!", 60,420,infont,0)
Draw.Text("A-Move Blast Left!", 59,419,infont,180)
Draw.Text("S-Move Blast Down!", 60,390,infont,0)
Draw.Text("S-Move Blast Down!", 59,389,infont,180)
Draw.Text("Spacebar-To Reset Fireblast!", 60,360,infont,0)
Draw.Text("Spacebar-To Reset Fireblast!", 59,359,infont,180)
infont:=Font.New("Times New Romen:14")
Draw.Text("Goal: Dark Mario has 3 lives and they're 5 purple fireblasts. Only one contains ", 60,335,infont,0)
Draw.Text("Goal: Dark Mario has 3 lives and they're 5 purple fireblasts. Only one contains ", 59,334,infont,180)
Draw.Text("Dark Mario's life! You can only move your blast 40 times before you burn up!", 60,315,infont,0)
Draw.Text("Dark Mario's life! You can only move your blast 40 times before you burn up!", 59,314,infont,180)
Draw.Text("Difficulty: Hard because the other four fireblasts are filled with surpries!", 60,295,infont,0)
Draw.Text("Difficulty: Hard because the other four fireblasts are filled with surpries!", 59,294,infont,180)
% Buttons
var keyboardcontrols1 : int := GUI.CreateButton (40,20,0, "First Stage Controls",keyboard1_see_again)
var play_game : int := GUI.CreateButton (610,20,0, "PLAY",mario_quest)
% Button Press (The Source Of The Stupid Code That Pops Up Right After
% You Close The Program Because Of The Version Of Windows Being The
% Latest Which I Hope Turing Fixes In 4.1.2)
loop
exit when GUI.ProcessEvent
end loop

end keyboard2

procedure keyboard1
cls
Music.PlayFileLoop ("Testing/Music/Super Mario Bros. 3 Medley.mp3")
% Control Pictures and Text
GUI.SetBackgroundColour (119)
picID:= keyboard_controls1
Pic.Draw (picID,40,60,picCopy)

% Control Title
infont:=Font.New("Times New Romen:30")
Draw.Text("CONTROLS FOR FIRST STAGE!", 60,520,infont,0)
Draw.Text("CONTROLS FOR FIRST STAGE!", 59,519,infont,4)

% Controls
infont:=Font.New("Times New Romen:18")
Draw.Text("Up Arrow Key-Jump!", 60,480,infont,0)
Draw.Text("Up Arrow Key-Jump!", 59,479,infont,4)
Draw.Text("Right Arrow Key-Walk Right!", 60,450,infont,0)
Draw.Text("Right Arrow Key-Walk Right!", 59,449,infont,4)
Draw.Text("Left Arrow Key-Walk Left!", 60,420,infont,0)
Draw.Text("Left Arrow Key-Walk Left!", 59,419,infont,4)
Draw.Text("Down Arrow Key-To Reset Fire Blast!", 60,390,infont,0)
Draw.Text("Down Arrow Key-To Reset Fire Blast!", 59,389,infont,4)
Draw.Text("Spacebar-To Shoot Fire Blast!", 60,360,infont,0)
Draw.Text("Spacebar-To Shoot Fire Blast!", 59,359,infont,4)
Draw.Text("Goal: You must shoot Dark Mario 6 times for him to die!", 60,330,infont,0)
Draw.Text("Goal: You must shoot Dark Mario 6 times for him to die!", 59,329,infont,4)
Draw.Text("Difficulty: Easy", 60,300,infont,0)
Draw.Text("Difficulty: Easy", 59,299,infont,4)
% Buttons
var keyboardcontrols1 : int := GUI.CreateButton (300,20,0, "Second Stage Controls",keyboard2)
% Button Press (The Source Of The Stupid Code That Pops Up Right After
% You Close The Program Because Of The Version Of Windows Being The
% Latest Which I Hope Turing Fixes In 4.1.2)
loop
exit when GUI.ProcessEvent
end loop

end keyboard1

% Game Menu
procedure title
cls
Music.PlayFileLoop ("Testing/Music/Ground Theme & Underground Theme.mp3")
% Pictures and Text
drawfill (20,20,114,114)
picID:= game_title
Pic.Draw (picID,40,40,picCopy)
infont:=Font.New("Times New Romen:40")
Draw.Text("MARIO VS. DARK MARIO",50,500,infont,0)
Draw.Text("MARIO ",51,499,infont,4)
Draw.Text (" VS.",58,499,infont,105)
Draw.Text(" DARK MARIO",53,499,infont,180)
% Buttons
var play_game : int := GUI.CreateButton (330,240,0, "PLAY",mario_quest)
var controls : int := GUI.CreateButton (310,210,0, "CONTROLS",keyboard1)
credit_to_me := GUI.CreateButton (323,180,0, "CREDIT",credit)
% Button Press (The Source Of The Stupid Code That Pops Up Right After
% You Close The Program Because Of The Version Of Windows Being The
% Latest Which I Hope Turing Fixes In 4.1.2)
loop
exit when GUI.ProcessEvent
end loop

end title
title
Tony




PostPosted: Tue Jan 06, 2015 2:29 am   Post subject: RE:I Need Help With Gui Buttons! Whenever I Apply, There Is This Glitch Where In Next Procedure Buttons Are Still There!

So you never exit any of those loops -- just throw more code on top. It follows that all of your buttons are still there. GUI.ProcessEvent checks if any of the active buttons have received an event, and processes them.

Think of a cleaner design with only one GUI.ProcessEvent.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
master-awesome




PostPosted: Tue Jan 06, 2015 12:37 pm   Post subject: Re: I Need Help With Gui Buttons! Whenever I Apply, There Is This Glitch Where In Next Procedure Buttons Are Still There

I tried your thing out, but when I reach procedure final_stage_begins , it starts to get stuck in a loop. I'm still checking the code over, but I'm not sure if this is actually going to work out because when I took out the process event, in the next procedure, the buttons still continued to be there even when you can't see them.
Tony




PostPosted: Tue Jan 06, 2015 1:42 pm   Post subject: RE:I Need Help With Gui Buttons! Whenever I Apply, There Is This Glitch Where In Next Procedure Buttons Are Still There!

There's GUI.Dispose and GUI.Hide, depending on what exactly you want the buttons to do.

Conceptually, people tend to think in terms of page/screen/scene. When the code flow enters a new scene for the first time, all of the GUI is setup. When the scene ends, the GUI elements are disposed.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
master-awesome




PostPosted: Tue Jan 06, 2015 6:16 pm   Post subject: Re: I Need Help With Gui Buttons! Whenever I Apply, There Is This Glitch Where In Next Procedure Buttons Are Still There

Okay so the GUI.Dispose thing doesn't work for me because I applied it several times before writing this post and now I actually had a closer examination by copying and pasting the example and realized that GUI.Dispose only works when GUI.Quit is applied and that kind of freezes my program when I try that. As of GUI.Hide and GUI.Show. I'm not actually sure of that one.

It would help if I was shown an example of this one otherwise, this may be something the inventors of Turing might need to look into.
Tony




PostPosted: Tue Jan 06, 2015 8:40 pm   Post subject: Re: I Need Help With Gui Buttons! Whenever I Apply, There Is This Glitch Where In Next Procedure Buttons Are Still There

master-awesome @ Tue Jan 06, 2015 6:16 pm wrote:
[size=18]realized that GUI.Dispose only works when GUI.Quit is applied

What is this claim based on?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
master-awesome




PostPosted: Wed Jan 07, 2015 1:25 pm   Post subject: Re: I Need Help With Gui Buttons! Whenever I Apply, There Is This Glitch Where In Next Procedure Buttons Are Still There

Another procedure!
Tony




PostPosted: Wed Jan 07, 2015 4:06 pm   Post subject: RE:I Need Help With Gui Buttons! Whenever I Apply, There Is This Glitch Where In Next Procedure Buttons Are Still There!

I would suggest reading more documentation to have a better idea at how GUI works and what's going on.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> General Discussion
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 10 Posts ]
Jump to:   


Style:  
Search: