Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Help with avoiding game
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
jordistheman




PostPosted: Mon Jan 17, 2011 2:17 pm   Post subject: Help with avoiding game

I'm making a game but i am having lots of trouble having the rain fall, and the stickman staying on the screen and moving, does anyone have any suggestions on how I can fix this I am very new to Turing and do not know a lot about this language.

this is it so far:


proc Intro
var ready : string
loop
View.Set ("title:Acid Rain, nocursor")
var title := Font.New ("@Terminal:40")
drawfillbox (0, 0, maxx, maxy, black)
Font.Draw ("Acid Rain!!!", 160, 280, title, yellow)
colourback (black)
colour (yellow)
locate (12, 14)
put "This is a 1 player game in which you must dodge the"
locate (13, 20)
put "Acid Rain. Have fun!"
locate (16, 38)
put "By Jordan Matthews"
locate (21, 10)
colour (yellow)
put "Type 'Go' when ready"
get ready
exit when ready = "Go"
end loop
end Intro
Intro
cls


var x, y : int := 0
colourback (black)

proc man
drawoval (30 + x, 30 + y, 6, 4, 14)
drawline (29 + x, 25 + y, 29 + x, 18 + y, 14)
drawline (29 + x, 23 + y, 40 + x, 22 + y, 14)
drawline (29 + x, 23 + y, 18 + x, 20 + y, 14)
drawline (29 + x, 18 + y, 35 + x, 10 + y, 14)
drawline (29 + x, 18 + y, 20 + x, 10 + y, 14)
end man

var chars : array char of boolean

loop

Input.KeyDown (chars)
drawline (0, 10, 700, 10, 14)
if chars (KEY_UP_ARROW) then
y := y + 0
end if
if chars (KEY_RIGHT_ARROW) then
x := x + 5
end if
if chars (KEY_LEFT_ARROW) then
x := x - 5
end if
if chars (KEY_DOWN_ARROW) then
y := y - 0
end if
man

if x < 0 or x > 628 then
colourback (black)
cls
colorback (yellow)
Text.Locate (8, 8)
color (red)
put "You Have lost"
end if

if View.WhatDotColour (x, y) = 10 then
colourback (red)
Text.Locate (8, 8)
color (blue)
put "You Have lost"
end if

% The "Draw.FillOval" program.
View.Set ("graphics")
for i : 1 .. 1


Draw.FillOval (400, 400, 50, 50, 10)
delay (50)

Draw.FillOval (400, 375, 50, 50, 10)
delay (50)

Draw.FillOval (400, 350, 50, 50, 10)
delay (50)

Draw.FillOval (400, 325, 50, 50, 10)
delay (50)

Draw.FillOval (400, 300, 50, 50, 10)
delay (50)

Draw.FillOval (400, 275, 50, 50, 10)
delay (50)

Draw.FillOval (400, 250, 50, 50, 10)
delay (50)

Draw.FillOval (400, 225, 50, 50, 10)
delay (50)

Draw.FillOval (400, 200, 50, 50, 10)
delay (50)

Draw.FillOval (400, 175, 50, 50, 10)
delay (50)

Draw.FillOval (400, 150, 50, 50, 10)
delay (50)

Draw.FillOval (400, 125, 50, 50, 10)
delay (50)

Draw.FillOval (400, 100, 50, 50, 10)
delay (50)

Draw.FillOval (400, 75, 50, 50, 10)
delay (50)

Draw.FillOval (400, 50, 50, 50, 10)
delay (50)

Draw.FillOval (400, 25, 50, 50, 10)
delay (50)

Draw.FillOval (400, 0, 50, 50, 10)
delay (50)


%second line
end for
for s : 1 .. 1
Draw.FillOval (500, 400, 50, 50, 10)
delay (50)
Draw.FillOval (500, 350, 50, 50, 10)
delay (50)

Draw.FillOval (500, 300, 50, 50, 10)
delay (50)

Draw.FillOval (500, 250, 50, 50, 10)
delay (50)

Draw.FillOval (500, 200, 50, 50, 10)
delay (50)

Draw.FillOval (500, 150, 50, 50, 10)
delay (50)

Draw.FillOval (500, 100, 50, 50, 10)
delay (50)

Draw.FillOval (500, 50, 50, 50, 10)
delay (50)

Draw.FillOval (500, 0, 50, 50, 10)
delay (50)
end for
for d : 1 .. 1

Draw.FillOval (300, 400, 40, 10, 10)
delay (50)

Draw.FillOval (300, 375, 40, 40, 10)
delay (50)

Draw.FillOval (300, 350, 40, 40, 10)
delay (50)

Draw.FillOval (300, 325, 40, 40, 10)
delay (50)

Draw.FillOval (300, 300, 40, 40, 10)
delay (50)

Draw.FillOval (300, 275, 40, 40, 10)
delay (50)

Draw.FillOval (300, 250, 40, 40, 10)
delay (50)

Draw.FillOval (300, 225, 40, 40, 10)
delay (50)

Draw.FillOval (300, 200, 40, 40, 10)
delay (50)

Draw.FillOval (300, 175, 40, 40, 10)
delay (50)

Draw.FillOval (300, 150, 40, 40, 10)
delay (50)

Draw.FillOval (300, 125, 40, 40, 10)
delay (50)

Draw.FillOval (300, 100, 40, 40, 10)
delay (50)

Draw.FillOval (300, 75, 40, 40, 10)
delay (50)

Draw.FillOval (300, 50, 40, 40, 10)
delay (50)

Draw.FillOval (300, 25, 40, 40, 10)
delay (50)

Draw.FillOval (300, 0, 40, 40, 10)
delay (50)
end for
for f : 1 .. 1

Draw.FillOval (300, 400, 30, 30, 10)
delay (50)

Draw.FillOval (300, 375, 30, 30, 10)
delay (50)

Draw.FillOval (300, 350, 30, 30, 10)
delay (50)

Draw.FillOval (300, 325, 30, 30, 10)
delay (50)

Draw.FillOval (300, 300, 30, 30, 10)
delay (50)

Draw.FillOval (300, 275, 30, 30, 10)
delay (50)

Draw.FillOval (300, 250, 30, 30, 10)
delay (50)

Draw.FillOval (300, 225, 30, 30, 10)
delay (50)

Draw.FillOval (300, 200, 30, 30, 10)
delay (50)

Draw.FillOval (300, 175, 30, 30, 10)
delay (50)

Draw.FillOval (300, 150, 30, 30, 10)
delay (50)

Draw.FillOval (300, 125, 30, 30, 10)
delay (50)

Draw.FillOval (300, 100, 30, 30, 10)
delay (50)

Draw.FillOval (300, 75, 30, 30, 10)
delay (50)

Draw.FillOval (300, 50, 30, 30, 10)
delay (50)

Draw.FillOval (300, 25, 30, 30, 10)
delay (50)

Draw.FillOval (300, 0, 30, 30, 10)
delay (50)

end for
for g : 1 .. 1
%5
Draw.FillOval (100, 400, 50, 50, 10)
delay (50)

Draw.FillOval (100, 375, 50, 50, 10)
delay (50)

Draw.FillOval (100, 350, 50, 50, 10)
delay (50)

Draw.FillOval (100, 325, 50, 50, 10)
delay (50)

Draw.FillOval (100, 300, 50, 50, 10)
delay (50)

Draw.FillOval (100, 275, 50, 50, 10)
delay (50)

Draw.FillOval (100, 250, 50, 50, 10)
delay (50)

Draw.FillOval (100, 225, 50, 50, 10)
delay (50)

Draw.FillOval (100, 200, 50, 50, 10)
delay (50)

Draw.FillOval (100, 175, 50, 50, 10)
delay (50)

Draw.FillOval (100, 150, 50, 50, 10)
delay (50)

Draw.FillOval (100, 125, 50, 50, 10)
delay (50)

Draw.FillOval (100, 100, 50, 50, 10)
delay (50)

Draw.FillOval (100, 75, 50, 50, 10)
delay (50)

Draw.FillOval (100, 50, 50, 50, 10)
delay (50)

Draw.FillOval (100, 25, 50, 50, 10)
delay (50)

Draw.FillOval (100, 0, 50, 50, 10)
delay (50)
end for
for h : 1 .. 1
%6
Draw.FillOval (200, 400, 50, 50, 10)
delay (50)
Draw.FillOval (200, 350, 50, 50, 10)
delay (50)

Draw.FillOval (200, 300, 50, 50, 10)
delay (50)

Draw.FillOval (200, 250, 50, 50, 10)
delay (50)

Draw.FillOval (200, 200, 50, 50, 10)
delay (50)

Draw.FillOval (200, 150, 50, 50, 10)
delay (50)

Draw.FillOval (200, 100, 50, 50, 10)
delay (50)

Draw.FillOval (200, 50, 50, 50, 10)
delay (50)

Draw.FillOval (200, 0, 50, 50, 10)
delay (50)
end for
for j : 1 .. 1
%7
Draw.FillOval (300, 400, 50, 50, 10)
delay (50)
Draw.FillOval (300, 360, 50, 50, 10)
delay (50)

Draw.FillOval (300, 320, 50, 50, 10)
delay (50)

Draw.FillOval (300, 280, 50, 50, 10)
delay (50)

Draw.FillOval (300, 240, 50, 50, 10)
delay (50)

Draw.FillOval (300, 200, 50, 50, 10)
delay (50)

Draw.FillOval (300, 160, 50, 50, 10)
delay (50)

Draw.FillOval (300, 120, 50, 50, 10)
delay (50)

Draw.FillOval (300, 80, 50, 50, 10)
delay (50)

Draw.FillOval (300, 40, 50, 50, 10)
delay (50)

Draw.FillOval (300, 0, 50, 50, 10)
delay (50)

end for





delay (10)
cls
end loop
Sponsor
Sponsor
Sponsor
sponsor
jordistheman




PostPosted: Mon Jan 17, 2011 2:23 pm   Post subject: RE:Help with avoiding game

HELP PLEASE
Tony




PostPosted: Mon Jan 17, 2011 2:56 pm   Post subject: RE:Help with avoiding game

You'd have to explain your question better. What kind of troubles are you having?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
jordistheman




PostPosted: Tue Jan 18, 2011 8:53 am   Post subject: RE:Help with avoiding game

The stickman and the rain cant fall at the same time but inbetween the rain the man can move but not when the rains falling. im trying to make the rain move but not stop the stick man so that they can not move togther
jordistheman




PostPosted: Tue Jan 18, 2011 8:54 am   Post subject: RE:Help with avoiding game

so tht they can move togther*
Tony




PostPosted: Tue Jan 18, 2011 10:13 am   Post subject: RE:Help with avoiding game

you should review how delay works.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
jordistheman




PostPosted: Thu Jan 20, 2011 1:36 pm   Post subject: RE:Help with avoiding game

no help
mirhagk




PostPosted: Thu Jan 20, 2011 2:32 pm   Post subject: RE:Help with avoiding game

What tony is saying is that your doing a delay every time you draw the rain. So that means that until it finally gets to the part where it gets the character, its just drawing a circle, waiting 50 ms then drawing another etc. What you want to do is store the position of the rain in a variable. Then you update rain, draw rain, check player movement, delay, loop.
ps what is this line for (you have it like 1000 times

for d : 1 .. 1

Did you not learn for loops? Because these are useless.

Or rather it seems like you copied this from someone else. The thing to note is that because of the delays, the "Draw.FillOval program" part of your code takes about 5 seconds to draw, which means you can only move once every 5 seconds.

so delete the rain part, add a variable to store the rain position, then ocne every frame, subtract from the y part, and check if the y is less than 0 put it at the top (at a random spot hopefully).

If you need any further help write back.

The thing to remember is that delays stop EVERYTHING, so since your stickman is only updated once each loop, and its with the acid rain, it gets updated once per rain cycle. Which is bad.
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: