proc X
Font.Draw ("Nobody Is Winning", 220, 100, fontc, 0)
loop
Font.Draw ("X", move, 200, fontb, 0)
drawline (315, 180, 315, 240, 0)
%drawline (0, 210, 305, 210, 0)
%drawline (335, 210, 640, 210, 0)
if hasch then
getch (movex)
if movex = "S" or movex = "s" then
move -= 10
Font.Draw ("X", move + 10, 200, fontb, 7)
elsif movex = "J" or movex = "j" then
move += 10
Font.Draw ("X", move - 10, 200, fontb, 7)
end if
cls
if move < 305 then
Font.Draw ("Player 1 Is Winning", 220, 100, fontc, 0)
elsif move > 305 then
Font.Draw ("Player 2 Is Winning", 220, 100, fontc, 0)
else
Font.Draw ("Nobody Is Winning", 220, 100, fontc, 0)
exit when move = 0 or move = maxx
end if
end if
end loop
end X
proc player1ptx
cls
Font.Draw ("Get Ready...", 220, 300, fontb, 0)
Font.Draw ("Press Any Key To Start The Countdown", 150, 100, fontd, 0)
locatexy (310, 50)
getch (ctc)
cls
for q : 1 .. 3
Font.Draw (intstr (countdown), 250, 150, fontcountdown, 0)
%locatexy (310, 50)
%put countdown
countdown := countdown - 1
delay (1000)
cls
end for
Font.Draw ("Go!!!", 120, 120, fontcountdown, 0)
delay (1000)
cls
X
end player1ptx
proc rtmm
cls
Font.Draw ("That Was Not An Option:", 85, 300, fontb, 0)
Font.Draw ("Redirecting To main menu", 85, 200, fontb, 0)
delay (600)
Font.Draw (".", 460, 200, fontb, 0)
delay (600)
Font.Draw (".", 470, 200, fontb, 0)
delay (600)
Font.Draw (".", 480, 200, fontb, 0)
delay (600)
end rtmm
%WELCOME MENU
color (0)
colorback (black)
cls
Font.Draw ("Welcome To Pull The X", 60, 300, fonta, 0)
delay (1000)
Font.Draw ("Press Any Key To Continue...", 200, 30, fontd, 0)
locatexy (470, 40)
getch (ctc)
%MAIN MENU
%loop
loop
colorback (7)
cls
Font.Draw ("Choose An Option From The List:", 85, 300, fontb, 0)
y := 220
for menuptx : 1 .. 3
y := y - 50
Font.Draw (mmptxoption (menuptx), 100, y, fontd, 0)
end for
locatexy (400, 120)
get mmptxchoice
%%%%%%%%%%%%%%%%% OPTION 1 %%%%%%%%%%%%%%%%%%
if mmptxchoice = 1 then
cls
Font.Draw ("Choose Mode", 100, 300, fontb, 0)
y := 220
for playptx : 1 .. 3
y := y - 50
Font.Draw (modeptx (playptx), 100, y, fontd, 0)
end for
locatexy (400, 120)
get modechoiceptx
if modechoiceptx = 1 then
player1ptx
end if
%%%%%%%%%%%%%%%%% OPTION 2 %%%%%%%%%%%%%%%%
elsif mmptxchoice = 2 then
cls
Font.Draw ("Instructions:", 220, 300, fontb, 0)
Font.Draw ("Tap Your Key Until The X Has Reached Your Side Of The Screen", 50, 180, fontd, 0)
Font.Draw ("Player 1 Controls:", 40, 120, fontc, 0)
Font.Draw ("S Key Moves The X To The Left", 20, 80, fontd, 0)
Font.Draw ("Player 2 Controls:", 360, 120, fontc, 0)
Font.Draw ("J Key Moves The X To The Right", 340, 80, fontd, 0)
Font.Draw ("Press Any Key To Continue...", 170, 10, fontd, 0)
locatexy (430, 10)
getch (ctc)
%%%%%%%%%%%%%%%%%% OPTION 3 %%%%%%%%%%%%%%%%%%%%%%%
elsif mmptxchoice = 3 then
exit
else
rtmm
end if
end loop
why doesnt't proc X end?
Sponsor Sponsor
Bacchus
Posted: Fri Mar 18, 2005 9:07 pm Post subject: (No subject)
caus e its in a loop and there no exit or exit when in it, so it just keeps going lol
mike200015
Posted: Fri Mar 18, 2005 11:27 pm Post subject: (No subject)
there is an exit when
Quote:
exit when move = 0 or move = maxx
Bacchus
Posted: Fri Mar 18, 2005 11:43 pm Post subject: (No subject)
oops didnt see that lol kinda hidden there try
code:
exit when move <= 0 or move >= maxx
cause 305 being -10 wwont give you 0 same for maxx (but u can set to a 5 if u want)
ssr
Posted: Sat Mar 19, 2005 1:05 pm Post subject: (No subject)
actually that wont fully work yet
U PUT IT IN THE WRONG LOOP!!
the exit when will only exit teh if statement not teh whole loop
just move it to right before end loop
try it
code:
setscreen ("graphics:640;400")
var y : int %%%%%%%%%%%%%%%%%%% temp?
%VARIABLE DECLARATION / ARRAY DECLARATION
var fonta := Font.New ("Amerigo BT:36")
var fontb := Font.New ("Amerigo BT:24")
var fontc := Font.New ("Amerigo BT:18")
var fontd := Font.New ("Amerigo BT:14")
var fontcountdown := Font.New ("Amerigo BT:144")
var ctc : string (1)
var movex : string (1)
var mmptxchoice : int
var modechoiceptx : int
var countdown : int := 3
var move : int := 305
var mmptxoption : flexible array 1 .. 3 of string
var modeptx : flexible array 1 .. 3 of string
proc X
Font.Draw ("Nobody Is Winning", 220, 100, fontc, 0)
loop
Font.Draw ("X", move, 200, fontb, 0)
drawline (315, 180, 315, 240, 0)
%drawline (0, 210, 305, 210, 0)
%drawline (335, 210, 640, 210, 0)
if hasch then
getch (movex)
if movex = "S" or movex = "s" then
move -= 10
Font.Draw ("X", move + 10, 200, fontb, 7)
elsif movex = "J" or movex = "j" then
move += 10
Font.Draw ("X", move - 10, 200, fontb, 7)
end if
cls
if move < 305 then
Font.Draw ("Player 1 Is Winning", 220, 100, fontc, 0)
elsif move > 305 then
Font.Draw ("Player 2 Is Winning", 220, 100, fontc, 0)
else
Font.Draw ("Nobody Is Winning", 220, 100, fontc, 0)
end if
end if
exit when move <= 0 or move >= maxx
end loop
end X
proc player1ptx
cls
Font.Draw ("Get Ready...", 220, 300, fontb, 0)
Font.Draw ("Press Any Key To Start The Countdown", 150, 100, fontd, 0)
locatexy (310, 50)
getch (ctc)
cls
for q : 1 .. 3
Font.Draw (intstr (countdown), 250, 150, fontcountdown, 0)
%locatexy (310, 50)
%put countdown
countdown := countdown - 1
delay (1000)
cls
end for
Font.Draw ("Go!!!", 120, 120, fontcountdown, 0)
delay (1000)
cls
X
end player1ptx
proc rtmm
cls
Font.Draw ("That Was Not An Option:", 85, 300, fontb, 0)
Font.Draw ("Redirecting To main menu", 85, 200, fontb, 0)
delay (600)
Font.Draw (".", 460, 200, fontb, 0)
delay (600)
Font.Draw (".", 470, 200, fontb, 0)
delay (600)
Font.Draw (".", 480, 200, fontb, 0)
delay (600)
end rtmm
%WELCOME MENU
color (0)
colorback (black)
cls
Font.Draw ("Welcome To Pull The X", 60, 300, fonta, 0)
delay (1000)
Font.Draw ("Press Any Key To Continue...", 200, 30, fontd, 0)
locatexy (470, 40)
getch (ctc)
%MAIN MENU
%loop
loop
colorback (7)
cls
Font.Draw ("Choose An Option From The List:", 85, 300, fontb, 0)
y := 220
for menuptx : 1 .. 3
y := y - 50
Font.Draw (mmptxoption (menuptx), 100, y, fontd, 0)
end for
locatexy (400, 120)
get mmptxchoice
%%%%%%%%%%%%%%%%% OPTION 1 %%%%%%%%%%%%%%%%%%
if mmptxchoice = 1 then
cls
Font.Draw ("Choose Mode", 100, 300, fontb, 0)
y := 220
for playptx : 1 .. 3
y := y - 50
Font.Draw (modeptx (playptx), 100, y, fontd, 0)
end for
locatexy (400, 120)
get modechoiceptx
if modechoiceptx = 1 then
player1ptx
end if
%%%%%%%%%%%%%%%%% OPTION 2 %%%%%%%%%%%%%%%%
elsif mmptxchoice = 2 then
cls
Font.Draw ("Instructions:", 220, 300, fontb, 0)
Font.Draw ("Tap Your Key Until The X Has Reached Your Side Of The Screen", 50, 180, fontd, 0)
Font.Draw ("Player 1 Controls:", 40, 120, fontc, 0)
Font.Draw ("S Key Moves The X To The Left", 20, 80, fontd, 0)
Font.Draw ("Player 2 Controls:", 360, 120, fontc, 0)
Font.Draw ("J Key Moves The X To The Right", 340, 80, fontd, 0)
Font.Draw ("Press Any Key To Continue...", 170, 10, fontd, 0)
locatexy (430, 10)
getch (ctc)
%%%%%%%%%%%%%%%%%% OPTION 3 %%%%%%%%%%%%%%%%%%%%%%%
elsif mmptxchoice = 3 then
exit
else
rtmm
end if
end loop
eh? hopefully it works
btw u want to shorten ur codes?
Bacchus
Posted: Sat Mar 19, 2005 3:57 pm Post subject: (No subject)
exit really only cause loops and for loops to exit, pretty sure it wouldnt matter if the exit is in an if cause i do it all the time
Cervantes
Posted: Sat Mar 19, 2005 6:16 pm Post subject: (No subject)
Bacchus wrote:
exit really only cause loops and for loops to exit, pretty sure it wouldnt matter if the exit is in an if cause i do it all the time
Bacchus is correct. The reason your code works, ssr, is because you used the >= and <=, rather than just = and =. Bacchus was right again.
ssr
Posted: Sat Mar 19, 2005 6:23 pm Post subject: (No subject)
ok but try it int he if statement, it wont work for me...
Sponsor Sponsor
ssr
Posted: Sat Mar 19, 2005 6:31 pm Post subject: (No subject)
try these 2 codes,
one will exit and the other wont
code:
var la:int
loop
get la
if la = 1 then
put 1
exit when la = 2
end if
end loop
code:
var la:int
loop
get la
if la = 1 then
put 1
end if
exit when la = 2
end loop
mike200015
Posted: Sat Mar 19, 2005 6:56 pm Post subject: (No subject)
yea.. thats tru.. only in some cases it doesnt matter.. because if its in the if statement.. then the program will only exit when it gets into the if statement, and satisfies the exit when .. but if u use an exit, not an exit when it matters.. like:
code:
var la:int
loop
get la
if la = 1 then
put 1
exit
end if
end loop
^ that will exit when u press 1.. so u need to put it in the if.. but:
code:
var la:int
loop
get la
if la = 1 then
put 1
end if
exit
end loop
^that will always exit.
ssr
Posted: Sat Mar 19, 2005 7:24 pm Post subject: (No subject)
lol ya exactly, thanks for the explanation mike.
mike200015
Posted: Sat Mar 19, 2005 8:23 pm Post subject: (No subject)
haha no problem ssr
Mr. T
Posted: Sat Mar 19, 2005 8:54 pm Post subject: (No subject)
horlickiki should be the one thanking you, lol
ssr
Posted: Sat Mar 19, 2005 9:03 pm Post subject: (No subject)
we all learnt something didnt we...
Bacchus
Posted: Sun Mar 20, 2005 12:48 am Post subject: (No subject)