
-----------------------------------
r.m_spy
Fri Nov 30, 2007 6:23 pm

Re:tug-o-war
-----------------------------------
var q:int:=Font.New("Sanserfif:72:bold")
var e:int:=Font.New("Sanserfif:42:bold")
      procedure CentreFont (s : string, x, y, f, clr : int)
    var w : int := Font.Width (s, f)
    Font.Draw (s, x - w div 2, y, f, clr)
end CentreFont
var k:array char of boolean
var l:char:=chr(203)
var r:char:=chr(205)
var a:char:=chr(97)
var d:char:=chr(100)
var p:char:=chr(112)
var qu:char:=chr(113)
var v:int:=300
var re:int
var sp:char:=chr(32)
var qa:int:=5
var t:int:=1
var x:int:=1
var we:int:=0
color(brightred)
put"put 1 for 1 player,2 for two players"
get re
setscreen ( "graphics:600;450" ) 
        CentreFont ("ready", maxx div 2,maxy div 2,q,brightred)
delay(1000)
cls
       CentreFont ("set", maxx div 2,maxy div 2,q,brightred)
delay(1000)
cls
       CentreFont ("go", maxx div 2,maxy div 2,q,brightred)   
if re=2 then
       loop
delay(100)
cls
colorback(black)
drawfillbox(v,10,v+10,20,brightred)
Input.KeyDown(k)
if k(l) then
if t=1 then
t:=t+1
v:=v-1
end if
elsif k(r) then
if t=2 then
t:=t-1
v:=v-10
end if
end if
if k(a) then
if x=1 then
x:=x+1
v:=v+10
end if
elsif k(p) then
cls
colorback(black)
CentreFont ("press space", maxx div 2,maxy div 2,e,brightred)
loop
Input.KeyDown(k) 
exit when k(sp) 
end loop
elsif k(d) then
if x=2 then
x:=x-1
v:=v+10
end if
end if
if v590 then
cls
       CentreFont ("player 2 wins", maxx div 2,maxy div 2,e,brightred)
       loop
       end loop
       end if
       Input.KeyDown(k)
       exit when k(qu)
end loop
else
       loop
delay(100)
cls
colorback(black)
drawfillbox(v,10,v+10,20,brightred)
Input.KeyDown(k)
if k(l) then
if t=1 then
t:=t+1
v:=v-10
end if
elsif k(p) then
cls
colorback(black)
CentreFont ("press space", maxx div 2,maxy div 2,e,brightred)
loop
Input.KeyDown(k) 
exit when k(sp) 
end loop
elsif k(r) then
if t=2 then
t:=t-1
v:=v-10
end if
else
v:=v+qa
end if
if v590 then
cls
color(brightred)
put we
       CentreFont ("cpu wins", maxx div 2,maxy div 2,e,brightred)
       loop
       end loop
       end if
       Input.KeyDown(k)
       exit when k(qu)
end loop
end if
cls
colorback(black)
CentreFont ("quit", maxx div 2,maxy div 2,e,brightred)
color(brightred)
put we

-----------------------------------
Euphoracle
Fri Nov 30, 2007 6:34 pm

RE:Re:tug-o-war
-----------------------------------
You should really wrap that in code tags, to make it more easily readable.

Perhaps this would be a good oppertunity to download turing. ;)

*does so*

-----------------------------------
Saad
Fri Nov 30, 2007 8:46 pm

RE:Re:tug-o-war
-----------------------------------
I would also suggest using better variables names. eg "we".

-----------------------------------
Euphoracle
Fri Nov 30, 2007 10:36 pm

RE:Re:tug-o-war
-----------------------------------
Likewise, I have no idea what is going on (mainly because I don't want to spend 30+ minutes decoding it, and, you know, time is money)

What is "t"?  time?  How about "v"? I can't even think of a logical name for "v" :|

-----------------------------------
r.m_spy
Sat Dec 01, 2007 12:13 pm

Re:tug-o-war
-----------------------------------
the variable mean nothing, and I do not know how how to post a tag

-----------------------------------
yusong
Wed Jan 02, 2008 11:28 am

RE:Re:tug-o-war
-----------------------------------
Is you play the computer
You can just hold down Right Arrow and keep pressing Left Arrow and you'll win

-----------------------------------
Tallguy
Mon Apr 14, 2008 11:57 am

RE:Re:tug-o-war
-----------------------------------
u should make it so that we see the rope that we're pulling...

-----------------------------------
repsoccer16
Tue Apr 15, 2008 7:58 am

RE:Re:tug-o-war
-----------------------------------
ya make a rope at least for the graphics.
