Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'TROM is a non-profit fanmade game, developed as a University Project. All rights over the name TROM reserved ©MDG and no Copyright infringement intended over the TRON name.
- 'Two lightcycles in a vast space.
- 'The one that hits the end of the playfield or the other lightcycle's trail loses.
- 'The Player who survives the round is given 1 point.
- 'First to 5 points wins the game
- 'Player 1 uses WASD and Player 2 uses the Arrow keys (↑←↓→)
- 'Don't forget to have fun and change the difficulty if you find it too easy or too hard /To be added
- If (GraphicsWindow.lastkey="F1") Then
- Easy()
- Reset()
- Endif
- If (GraphicsWindow.lastkey="F2") Then
- Normal()
- Reset()
- Endif
- If (GraphicsWindow.lastkey="F3") Then
- Hard()
- Reset()
- Endif
- GraphicsWindow.KeyDown=OnKeyDown 'Controls
- GraphicsWindow.backgroundcolor="Black"
- gw=GraphicsWindow.Width 'ShortenerWidth
- gh=GraphicsWindow.Height 'ShortenerHeight
- Red = 0 'Red score
- Blue = 0 'Blue score
- Reset() 'Resetting Trom positions
- Start: 'Game Start
- x1 = x1 + deltax1 'Movement First TromX
- y1 = y1 + deltay1 'Movement First TromY
- x2 = x2 + deltax2 'Movement Second TromX
- y2 = y2 + deltay2 ''Movement Second TromY
- 'Check if First Trom touches own trail or Second Trom's trail
- If (trail[x1][y1] = 1 Or trail[x1][y1] = 2) then
- GraphicsWindow.ShowMessage("1 point To Blue","Red hit Blue's trail")
- Blue=Blue+1
- Reset()
- EndIf
- 'Check if Second Trom touches own trail or First Trom's trail
- If (trail[x2][y2] = 2 Or trail[x2][y2] =1) then
- GraphicsWindow.ShowMessage("1 point To Red","Blue hit Red's trail")
- Red= Red+1
- Reset()
- EndIf
- 'Checks if the First Trom or Second Trom touch the end of the screen
- If (x1 = gw-8 Or y1=gh-8 Or y1 < 0 Or x1 < 0) then
- GraphicsWindow.ShowMessage("1 point to Blue","Red hit a wall")
- Blue=Blue+1
- Reset()
- Endif
- If (x2 = gw-8 Or y2=gh-8 Or y2 < 0 Or x2 < 0) Then
- GraphicsWindow.ShowMessage("1 point To Red","Blue hit a wall")
- Red = Red+1
- Reset()
- EndIf
- Shapes.Move(Trom1,x1,y1) 'Moving the First Trom's shape
- Shapes.Move(Trom2,x2,y2) 'Moving the Second Trom's shape
- a1=Shapes.GetLeft(Trom1) 'Orange Trail X
- b1=Shapes.GetTop(Trom1) 'Orange Trail Y
- a2=Shapes.GetLeft(Trom2) 'Cyan Trail X
- b2=Shapes.GetTop(Trom2) 'Cyan Trail Y
- GraphicsWindow.brushcolor="Orange"
- GraphicsWindow.FillRectangle(x1,y1,8,8) 'Creating First Trom's trail
- GraphicsWindow.brushcolor="Cyan"
- GraphicsWindow.FillRectangle(x2,y2,8,8) 'Creating Second Trom's trail
- trail[x1][y1] = 1 'First Trom trail array
- trail[x2][y2] = 2 'Second Trom trail array
- Program.Delay(5) 'Adjusting Game speed
- Goto Start
- Sub OnKeyDown 'Controls
- If (GraphicsWindow.LastKey="D") Then
- deltax1 = 1
- deltay1 = 0
- EndIf
- If (GraphicsWindow.lastkey="Right")Then
- deltax2 = 1
- deltay2 = 0
- EndIf
- If GraphicsWindow.LastKey="A" Then
- deltax1 = -1
- deltay1 = 0
- EndIf
- If (GraphicsWindow.LastKey="Left") Then
- deltax2 = -1
- deltay2 = 0
- EndIf
- If GraphicsWindow.lastkey="W" Then
- deltax1 = 0
- deltay1 = -1
- EndIf
- If (GraphicsWindow.lastkey="Up")Then
- deltax2 = 0
- deltay2 = -1
- EndIf
- If GraphicsWindow.lastkey="S" Then
- deltax1 = 0
- deltay1 = 1
- EndIf
- If(GraphicsWindow.lastkey="Down")Then
- deltax2 = 0
- deltay2 = 1
- EndIf
- If (GraphicsWindow.lastkey="F1") Then
- Easy()
- EndIf
- If (GraphicsWindow.lastkey="F2") Then
- Normal()
- EndIf
- If (GraphicsWindow.lastkey="F3") Then
- Hard()
- EndIf
- EndSub
- Sub Reset 'Resetting Trom positions
- GraphicsWindow.Clear()
- GraphicsWindow.Title = ("Trom "+ Red+" : "+Blue) 'Displays score in Title
- If (Red=5) Then
- Sound.PlayChime()
- GraphicsWindow.ShowMessage("Red Wins the Game","Better luck next time, Blue")
- Program.End()
- EndIf
- If (Blue=5) Then
- Sound.PlayChime()
- GraphicsWindow.ShowMessage("Blue Wins the Game","Better luck next time, Red")
- Program.End()
- EndIf
- 'First Shape
- GraphicsWindow.pencolor="Red"
- GraphicsWindow.brushcolor= "Red"
- Trom1= Shapes.AddRectangle(8,8)
- 'Second Shape
- GraphicsWindow.pencolor="Blue"
- GraphicsWindow.BrushColor= "Blue"
- Trom2= Shapes.AddRectangle(8,8)
- x1= 30 'First Trom's X
- y1= 30 'First Trom's Y
- deltax1 = 1 'First Trom's direction X
- deltay1 = 0 'First Trom's direction Y
- x2 = gw-30 'Second Trom's X
- y2 = gh-30 'Second Trom's Y
- deltax2 = -1 'Second Trom's direction X
- deltay2 = 0 'Second Trom's direction y
- trail = "" 'Removing old Trom trails
- EndSub
- Sub Normal
- GraphicsWindow.Show()
- GraphicsWindow.Width=560
- GraphicsWindow.Height=560
- EndSub
- Sub Easy
- GraphicsWindow.Show()
- GraphicsWindow.Width=640
- GraphicsWindow.Height=640
- EndSub
- Sub Hard
- GraphicsWindow.Show()
- GraphicsWindow.Width=400
- GraphicsWindow.Height=400
- EndSub
Advertisement
Add Comment
Please, Sign In to add comment