Any Suggestions??
Author |
Message |
JMSS041
|
Posted: Tue Dec 16, 2008 11:24 am Post subject: Any Suggestions?? |
|
|
My program is below. Does anyone have any suggestions of how to improve it??
Turing: |
import GUI
View.Set ("graphics:600;800,nobuttonbar")
GUI.SetBackgroundColour (grey)
procedure Start
GUI.Quit
end Start
procedure Instructions
end Instructions
procedure Load
end Load
% Place some buttons.
var b1 := GUI.CreateButton (10, 370, 100, "Start Game", Start )
var b2 := GUI.CreateButton (130, 370, 100, "Instructions", Instructions )
var b3 := GUI.CreateButton (250, 370, 100, "Load Game", Load )
loop
exit when GUI.ProcessEvent
end loop
cls
setscreen ("graphics:900 ,650") % This adjusts your screen size, you can adjust it to whatever you like
% Game Options Variables
put "Are you ready to play Cutthroat?"
var name : string % You can ask the user to input their name
var age : real % You can ask the user to input their age
var User_Input : string
var User_Level : int := 1
var User_Race : string
var User_Class : string
var User_Gender : string
var User_CurrentLife : int
var User_Strength : int
var User_Intelligence : int
var User_Experience : real
var User_NextLevel : int
var User_Gold : int
var User_Weapon : string
var User_WeapDam : int
var User_Sheild : string
var User_ShDef : int
var User_Armor : string
var User_ArDef : int
var User_Defense : real
var User_Damage : real
put "Enter your name." %This is where you create your character.%
get name
put "Enter you age."
get age
put "what is your class?"
loop
put "Enter User_Race."
put "Human - Can easily change its class. They are an excellent choice for beginners."
put "Elf - They are known for their poetry, song, and magical arts. THey also show great skil with weapons, and strategy."
put "Dwarf - They are known for their skill in warefare, their ability to withstand physical and nagical punishment, and their hard work."
put "Gnome - They are smaller than Dwaves, and make good alchenists, and technicians."
put "Halfling - They are clever, capable, and resouceful suvivers."
put "Half Elf - They get curiosity, and ambition from their human parent, and the love of poetry and song from their elf parent."
put "Alien - They are skilled in magic. They use very powerful magic that is too complicated for even the most powerful wizards to learn."
put "Half Orc - Half orc, half human. They like fighting more than argueing."
put "Demon - Thye don't have a living body, and are more ghost like, than human like."
get User_Race
exit when User_Race = "Human" or User_Race = "Elf" or
User_Race = "Dwarf" or User_Race = "Gnome" or User_Race = "Halfling" or
User_Race = "Half Elf" or User_Race = "Alien" or User_Race = "Half Orc" or
User_Race = "Demon"
end loop
loop
cls
put "Enter Gender "
put "Male or Female ?"
get User_Gender
cls
exit when User_Gender = "Male" or User_Gender = "Female"
end loop
loop
exit when GUI.ProcessEvent
end loop
var b4 := GUI.CreateButton (300, 370, 100, "Continue", Start )
procedure Continue
GUI.Quit
end Continue
const groundColour := 2
const missileColour1 := purple
const missileColour2 := red
const explosionColour := 2
const playerColour := blue
const playerSpeed := 4
const turnDelay := 100
const outOfPlay := - 1
const maxMissiles := 20
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Global Variables %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
var numMissiles : int := 3 % the number of missiles in play
var evadedMissiles : int := 0 % total number of missiles evaded
var tx : int := maxx div 2 % the x position of the player in pixels
var ty : int := maxy div 2 % the y position of the player in pixels
var turns, timer, dist : int
/**************************************************************
* This procedure gives the instructions for the game. *
**************************************************************/
put "You are a pilot over Zornastria, somewhere. Unfortunately, the missile"
put "defence system has been activated and is now turned against"
put "you! Even worse, the missiles are heat seeking missiles and"
put "head straight for you. Luckily if you manuever carefully,"
put "you can dodge them until they run out of fuel, hopefully."
put skip
put "To pilot your aircraft, use the mouse. When the mouse button"
put "is pressed, your plane moves toward your mouse."
colour (blue)
put "Your ship is the colour of this wording"
colour (2)
put "The missiles start"
put "out coloured " ..
colour (purple)
put "the colour of this wording" ..
colour (2)
put " and turn " ..
colour (red)
put "the colour of this wording" ..
colour (2)
put "when they run out of fuel. You"
put "must attempt to survive as long as you can. After surviving each"
put "wave, there will be another wave immediately following."
put skip
put "Good Luck! You WILL need it, unless you're THAT good!!!!"
put skip
put "At your own risk, hit any key to start the game.............."
Input.Pause
cls
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This procedure draws the player. %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
procedure DrawPlayer (clr : int)
Draw.FillStar (round (tx - 3), round (ty - 3), round (tx + 3), round (ty + 3), clr )
end DrawPlayer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This procedure handles any key strokes by reading any char %
% from the keyboard and moving the player in response to it. %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
procedure ControlPlayer
var x, y, b : int
Mouse.Where (x, y, b )
if b = 1 and (x not= tx or y not= ty ) then
DrawPlayer (0)
var d : real := sqrt ((x - tx ) ** 2 + (y - ty ) ** 2)
var dx : int := round ((x - tx ) * playerSpeed / d )
var dy : int := round ((y - ty ) * playerSpeed / d )
if abs (dx ) > abs (x - tx ) then
tx := x
else
tx := tx + dx
end if
if abs (dy ) > abs (y - ty ) then
ty := y
else
ty := ty + dy
end if
% Make certain the player doesn't go off the screen.
if tx < 10 then
tx := 10
elsif tx > maxx - 10 then
tx := maxx - 10
end if
if ty < 10 then
ty := 10
elsif ty > maxy - 10 then
ty := maxy - 10
end if
% Draw the player in its new position
DrawPlayer (playerColour )
end if
end ControlPlayer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Main Body %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
var px, py : array 1 .. maxMissiles of int
% The position array for the missiles
var vx, vy : array 1 .. maxMissiles of int
% The velocity array for the missiles
randomize
setscreen ("graphics,noecho")
Instructions
loop
% Initialize the missile array.
for i : 1 .. numMissiles
px (i ) := Rand.Int (0, maxx)
py (i ) := 0
vx (i ) := 0
vy (i ) := Rand.Int (1, 5)
end for
% Draw the screen
cls
drawline (0, 0, maxx, 0, 1)
DrawPlayer (playerColour )
% Set the clock and number of elapsed turns
turns := 0
% The main loop
loop
turns + = 1
% For each missile: determine the new x velocity
% determine the new y velocity
% set the new missile position
% draw a travel line
% check to see if it hit the ground
% check to see if it hit the player
for i : 1 .. numMissiles
const ox : int := px (i )
const oy : int := py (i )
if ox not= outOfPlay then
% Determine the x velocity
dist := abs (vx (i )) * (abs (vx (i )) + 1) div 2
if vx (i ) < 0 and ox - dist < 0 then
vx (i ) + = 2
elsif vx (i ) > 0 and ox + dist > maxx then
vx (i ) - = 2
elsif turns > 100 then
if turns mod 20 = 0 then
vx (i ) - = sign (vx (i ))
end if
elsif ox < tx then
vx (i ) + = 1
elsif ox > tx then
vx (i ) - = 1
end if
% Determine the y velocity
dist := abs (vy (i )) * (abs (vy (i )) + 1) div 2
if vy (i ) > 0 and oy + dist > maxy then
vy (i ) - = 2
elsif turns > 100 then
if turns mod 8 = 0 then
vy (i ) - = 1
end if
elsif vy (i ) < 0 and oy - dist < -turns div 15 then
vy (i ) + = 2
elsif oy < ty then
vy (i ) + = 1
elsif oy > ty then
vy (i ) - = 1
end if
% Set the new missile position
px (i ) + = vx (i )
py (i ) + = vy (i )
% Draw a travel line
if turns > 100 then
Draw.ThickLine (ox, oy, px (i ), py (i ), 1, missileColour2 )
else
Draw.ThickLine (ox, oy, px (i ), py (i ), 2, missileColour1 )
end if
% Check to see if it hit the ground
if py (i ) <= 0 then
drawline (px (i ), 0, px (i ) - 4, 4, explosionColour )
drawline (px (i ), 0, px (i ), 6, explosionColour )
drawline (px (i ), 0, px (i ) + 4, 4, explosionColour )
px (i ) := outOfPlay
evadedMissiles + = 1
end if
% Check to see if it hit the player
if Math.DistancePointLine (tx, ty, ox, oy, px (i ), py (i )) < 3 then
drawfillstar (tx - 7, ty - 7, tx + 7, ty + 7, brightblue)
locate (10, 5)
put "You evaded ", evadedMissiles, " missile(s)! "
put "You could have done better!! "
put "Some people already have...so try harder!!!!!!!!!!"
put skip
put skip
put "If this is your best, you need major improvement"
put skip
put "THIS MEANS YOU........JB"
locate (1, 1)
delay (500)
return
end if
end if
end for
% Check if the player is being controlled
ControlPlayer
% This is a timer delay loop to make sure that each turn takes
% the same length of time to execute, regardless of the number
% of missiles on the screen
Time.DelaySinceLast (30)
% This will leave the loop when all the missiles have crashed.
var endNow : boolean := true
for i : 1 .. numMissiles
if px (i ) not= outOfPlay then
endNow := false
end if
end for
exit when endNow
end loop
% After each time all the missiles have crashed, add 1 to the number
% of missiles with a maximum of maxMissiles.
numMissiles + = 1
if numMissiles > maxMissiles then
numMissiles := maxMissiles
end if
end loop
|
Mod Edit: Remember to use syntax tags! Thanks code: | [syntax="Turing"]Code Here[/syntax] |
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
DemonWasp
|
Posted: Tue Dec 16, 2008 11:52 am Post subject: RE:Any Suggestions?? |
|
|
1: Instructions don't work.
2: Use an image instead of a star for the airship.
3: Glancing at your code, I see nothing after dodging missiles. My name, age, race and class are completely irrelevant to any of the gameplay I've seen so far.
4: A scoreboard. There's a use for the character's (or player's) name. Just record who dodged how many missiles in a text file. |
|
|
|
|
|
dc116
|
Posted: Tue Dec 16, 2008 6:23 pm Post subject: RE:Any Suggestions?? |
|
|
I have no idea what the age part is for. |
|
|
|
|
|
Parker
|
Posted: Thu Dec 18, 2008 8:34 am Post subject: RE:Any Suggestions?? |
|
|
Gameplay isnt bad, kind of fun in my opinion. But as the above mentioned, I noticed that the age, race, and name dont really matter at all. Is the race part for something in the future of the game? |
|
|
|
|
|
JMSS041
|
Posted: Thu Dec 18, 2008 12:39 pm Post subject: Re: Any Suggestions?? |
|
|
Ok This is the new one I edited with your input.
Tell me how this could be improved.
Turing: | import GUI
View.Set ("graphics:600;800,nobuttonbar")
GUI.SetBackgroundColour (grey)
procedure Start
GUI.Quit
end Start
procedure Instructions
end Instructions
procedure Load
end Load
% Place some buttons.
var b1 := GUI.CreateButton (10, 370, 100, "Start Game", Start )
var b2 := GUI.CreateButton (130, 370, 100, "Instructions", Instructions )
var b3 := GUI.CreateButton (250, 370, 100, "Load Game", Load )
loop
exit when GUI.ProcessEvent
end loop
cls
setscreen ("graphics:900 ,650") % This adjusts your screen size, you can adjust it to whatever you like
% Game Options Variables
put "Are you ready to play Cut Throat?" % You can ask the user to input their name % You can ask the user to input their age
var User_Input : string
var User_Level : int := 1
var User_CurrentLife : int
var User_Strength : int
var User_Intelligence : int
var User_Experience : real
var User_NextLevel : int
var User_Gold : int
var User_Weapon : string
var User_WeapDam : int
var User_Sheild : string
var User_ShDef : int
var User_Armor : string
var User_ArDef : int
var User_Defense : real
var User_Damage : real
loop
exit when GUI.ProcessEvent
end loop
var b4 := GUI.CreateButton (300, 370, 100, "Continue", Start )
procedure Continue
GUI.Quit
end Continue
const groundColour := 2
const missileColour1 := purple
const missileColour2 := red
const explosionColour := 2
const playerColour := blue
const playerSpeed := 4
const turnDelay := 100
const outOfPlay := - 1
const maxMissiles := 20
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Global Variables %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
var numMissiles : int := 3 % the number of missiles in play
var evadedMissiles : int := 0 % total number of missiles evaded
var tx : int := maxx div 2 % the x position of the player in pixels
var ty : int := maxy div 2 % the y position of the player in pixels
var turns, timer, dist : int
/**************************************************************
* This procedure gives the instructions for the game. *
**************************************************************/
put "You are a pilot over Zornastria, somewhere. Unfortunately, the missile"
put "defence system has been activated and is now turned against"
put "you! Even worse, the missiles are heat seeking missiles and"
put "head straight for you. Luckily if you manuever carefully,"
put "you can dodge them until they run out of fuel, hopefully."
put skip
put "To pilot your aircraft, use the mouse. When the mouse button"
put "is pressed, your plane moves toward your mouse."
colour (blue)
put "Your ship is the colour of this wording"
colour (2)
put "The missiles start"
put "out coloured " ..
colour (purple)
put "the colour of this wording" ..
colour (2)
put " and turn " ..
colour (red)
put "the colour of this wording" ..
colour (2)
put "when they run out of fuel. You"
put "must attempt to survive as long as you can. After surviving each"
put "wave, there will be another wave immediately following."
put skip
put "Good Luck! You WILL need it, unless you're THAT good!!!!"
put skip
put "At your own risk, hit any key to start the game.............."
Input.Pause
cls
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This procedure draws the player. %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
procedure DrawPlayer (clr : int)
Draw.FillStar (round (tx - 3), round (ty - 3), round (tx + 3), round (ty + 3), clr )
end DrawPlayer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This procedure handles any key strokes by reading any char %
% from the keyboard and moving the player in response to it. %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
procedure ControlPlayer
var x, y, b : int
Mouse.Where (x, y, b )
if b = 1 and (x not= tx or y not= ty ) then
DrawPlayer (0)
var d : real := sqrt ((x - tx ) ** 2 + (y - ty ) ** 2)
var dx : int := round ((x - tx ) * playerSpeed / d )
var dy : int := round ((y - ty ) * playerSpeed / d )
if abs (dx ) > abs (x - tx ) then
tx := x
else
tx := tx + dx
end if
if abs (dy ) > abs (y - ty ) then
ty := y
else
ty := ty + dy
end if
% Make certain the player doesn't go off the screen.
if tx < 10 then
tx := 10
elsif tx > maxx - 10 then
tx := maxx - 10
end if
if ty < 10 then
ty := 10
elsif ty > maxy - 10 then
ty := maxy - 10
end if
% Draw the player in its new position
DrawPlayer (playerColour )
end if
end ControlPlayer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Main Body %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
var px, py : array 1 .. maxMissiles of int
% The position array for the missiles
var vx, vy : array 1 .. maxMissiles of int
% The velocity array for the missiles
randomize
setscreen ("graphics,noecho")
Instructions
loop
% Initialize the missile array.
for i : 1 .. numMissiles
px (i ) := Rand.Int (0, maxx)
py (i ) := 0
vx (i ) := 0
vy (i ) := Rand.Int (1, 5)
end for
% Draw the screen
cls
drawline (0, 0, maxx, 0, 1)
DrawPlayer (playerColour )
% Set the clock and number of elapsed turns
turns := 0
% The main loop
loop
turns + = 1
% For each missile: determine the new x velocity
% determine the new y velocity
% set the new missile position
% draw a travel line
% check to see if it hit the ground
% check to see if it hit the player
for i : 1 .. numMissiles
const ox : int := px (i )
const oy : int := py (i )
if ox not= outOfPlay then
% Determine the x velocity
dist := abs (vx (i )) * (abs (vx (i )) + 1) div 2
if vx (i ) < 0 and ox - dist < 0 then
vx (i ) + = 2
elsif vx (i ) > 0 and ox + dist > maxx then
vx (i ) - = 2
elsif turns > 100 then
if turns mod 20 = 0 then
vx (i ) - = sign (vx (i ))
end if
elsif ox < tx then
vx (i ) + = 1
elsif ox > tx then
vx (i ) - = 1
end if
% Determine the y velocity
dist := abs (vy (i )) * (abs (vy (i )) + 1) div 2
if vy (i ) > 0 and oy + dist > maxy then
vy (i ) - = 2
elsif turns > 100 then
if turns mod 8 = 0 then
vy (i ) - = 1
end if
elsif vy (i ) < 0 and oy - dist < -turns div 15 then
vy (i ) + = 2
elsif oy < ty then
vy (i ) + = 1
elsif oy > ty then
vy (i ) - = 1
end if
% Set the new missile position
px (i ) + = vx (i )
py (i ) + = vy (i )
% Draw a travel line
if turns > 100 then
Draw.ThickLine (ox, oy, px (i ), py (i ), 1, missileColour2 )
else
Draw.ThickLine (ox, oy, px (i ), py (i ), 2, missileColour1 )
end if
% Check to see if it hit the ground
if py (i ) <= 0 then
drawline (px (i ), 0, px (i ) - 4, 4, explosionColour )
drawline (px (i ), 0, px (i ), 6, explosionColour )
drawline (px (i ), 0, px (i ) + 4, 4, explosionColour )
px (i ) := outOfPlay
evadedMissiles + = 1
end if
% Check to see if it hit the player
if Math.DistancePointLine (tx, ty, ox, oy, px (i ), py (i )) < 3 then
drawfillstar (tx - 7, ty - 7, tx + 7, ty + 7, brightblue)
locate (10, 5)
put "You evaded ", evadedMissiles, " missile(s)! "
locate (1, 1)
delay (500)
return
end if
end if
end for
% Check if the player is being controlled
ControlPlayer
% This is a timer delay loop to make sure that each turn takes
% the same length of time to execute, regardless of the number
% of missiles on the screen
Time.DelaySinceLast (30)
% This will leave the loop when all the missiles have crashed.
var endNow : boolean := true
for i : 1 .. numMissiles
if px (i ) not= outOfPlay then
endNow := false
end if
end for
exit when endNow
end loop
% After each time all the missiles have crashed, add 1 to the number
% of missiles with a maximum of maxMissiles.
numMissiles + = 1
if numMissiles > maxMissiles then
numMissiles := maxMissiles
end if
end loop
|
Mod Edit: Remember to use syntax tags! code: | [syntax="Turing"]Code Here[/syntax] |
|
|
|
|
|
|
|
|