School project
Author |
Message |
BlackRoseUYA
|
Posted: Sat Jun 16, 2007 6:40 pm Post subject: School project |
|
|
I need a little help with an exam project for the end of the year. I have to make a game using Turing.
I got an idea for a game already. It's like this, it's Capture The Flag but the flag's moving all over the place. There's two bases on each side of the map and obstacles as well. I just need help with the coding for getting the flag to move and bump off of objects and the base but not in the slot where it can go in, getting the two players to move and collision detection.
This is what my coding looks like thus far:
setscreen("graphics:640;400")
colourback (blue)
colour (11)
drawfillbox (600,0,0,700,blue)
var start : string
start := "start"
put "Type 'start' and press the 'enter' key to begin."
get start
if start = "start" then
cls
end if
var CTF : int := 300
var CTFspeedX : int := 5
var CTFspeedY : int := 5
var CTFflag : int := 5
var BlueTeam : int := 10
var RedTeam : int := 625
var BlueSpeedY : int := 185
var RedSpeed : int := 185
drawfilloval (CTF,185,6,6,white)
drawfilloval (BlueTeam,185,10,10,11)
drawfilloval (RedTeam,RedSpeed,10,10,12)
delay (1000)
var chars : array char of boolean |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
DifinityRJ

|
Posted: Sat Jun 16, 2007 8:07 pm Post subject: Re: School project |
|
|
You need a little help? sounds like you need a lot of help. Anyways this is basically how you do movement for your players except that when your adding to the x position and y positions later on when you have collision, consider making them into variables or just getting booleans to check if your allowed to move.
code: |
setscreen ("graphics:640;400,offscreenonly")
colourback (blue)
colour (11)
drawfillbox (600, 0, 0, 700, blue)
var start : string
start := "start"
put "Type 'start' and press the 'enter' key to begin."
get start
if start = "start" then
cls
end if
var x1, y1, x2, y2 : int
var CTF : int := 300
var CTFspeedX : int := 5
var CTFspeedY : int := 5
var CTFflag : int := 5
var BlueTeam : int := 10
var RedTeam : int := 625
var BlueSpeedY : int := 185
var RedSpeed : int := 185
const Frames : real := 30
x1 := BlueTeam + 20
y1 := 185
x2 := RedTeam - 20
y2 := 185
delay (1000)
var chars : array char of boolean
proc movement
if chars ('w') then
y1 += 1
end if
if chars ('s') then
y1 -= 1
end if
if chars ('a') then
x1 -= 1
end if
if chars ('d') then
x1 += 1
end if
if chars (KEY_UP_ARROW) then
y2 += 1
end if
if chars (KEY_DOWN_ARROW) then
y2 -= 1
end if
if chars (KEY_LEFT_ARROW) then
x2 -= 1
end if
if chars (KEY_RIGHT_ARROW) then
x2 += 1
end if
end movement
proc drawplayers
Draw.FillOval (x1, y1, 5, 5, 11)
Draw.FillOval (x2, y2, 5, 5, 12)
end drawplayers
proc drawother
drawfilloval (CTF, 185, 6, 6, white)
drawfilloval (BlueTeam, 185, 10, 10, 11)
drawfilloval (RedTeam, RedSpeed, 10, 10, 12)
end drawother
loop
Input.KeyDown (chars)
cls
movement
drawplayers
drawother
View.Update
Time.DelaySinceLast (round (400 / Frames))
end loop
|
|
|
|
|
|
 |
HeavenAgain

|
Posted: Sun Jun 17, 2007 9:24 am Post subject: Re: School project |
|
|
code: |
var start : string
start := "start"
put "Type 'start' and press the 'enter' key to begin."
get start
if start = "start" then
cls
end if
.........
|
this part is logically wrong, because, when user enters "start" the program just cls, and then continues, but if they enter something else, like "stop" you bascailly just skip the cls part, and move on to this game that you are making, so i suggest you make a loop for that part example:
code: |
var start : string
% start := "start" % you can omit this line, or just make it into a ground like ""
put "Type 'start' and press the 'enter' key to begin."
loop
get start
if start = "start" then
cls
end if
exit when start = "start"
end loop
.....
|
|
|
|
|
|
 |
BlackRoseUYA
|
Posted: Sun Jun 17, 2007 3:55 pm Post subject: Re: School project |
|
|
Next i have to get the flag moving. |
|
|
|
|
 |
MyronMenezes
|
Posted: Sun Jun 17, 2007 8:09 pm Post subject: Re: School project |
|
|
We're not exactly going to write your whole code. Use x, y coordinates though to move it around. |
|
|
|
|
 |
DifinityRJ

|
Posted: Sun Jun 17, 2007 8:19 pm Post subject: Re: School project |
|
|
Blackrose, you obviously have no idea what your doing, and we are not going to write your whole code for you, as stated above.
Go read some tutorials, look at people's codes, change things around, try and learn why things happen, and try to apply them to your own program, (not by copying then pasting).
Good luck. |
|
|
|
|
 |
BlackRoseUYA
|
Posted: Mon Jun 18, 2007 6:38 am Post subject: Re: School project |
|
|
Good point, sorry about that. I'll see what I can do about this.
P.S. Thanks for the help so far though, you're the best.  |
|
|
|
|
 |
|
|