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

Username:   Password: 
 RegisterRegister   
 Missile Help in Missile Command
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
MOUSECORD




PostPosted: Tue Jun 08, 2004 4:30 pm   Post subject: Missile Help in Missile Command

I am making Missile Command i have most things completed except the core of the game (the missiles) that drop from the sky... i just can't figure out a way to program the missiles to fall... or anything ... i need some insight on how to make lines drop gradually from the top if someone could help it will be greatly appreciated... Thanks
Sponsor
Sponsor
Sponsor
sponsor
Paul




PostPosted: Tue Jun 08, 2004 4:35 pm   Post subject: (No subject)

this should be in "turing help" not "turing submissions", here is where u submit your programs.
Tony




PostPosted: Tue Jun 08, 2004 5:11 pm   Post subject: (No subject)

drop as in
code:

View.Set ("offscreenonly")
var y : int := maxy

loop
    exit when y < 0
    y -= 5
    Draw.FillOval (100, y, 5, 5, red)
    View.Update
    cls
end loop

? Thinking
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
MOUSECORD




PostPosted: Tue Jun 08, 2004 5:16 pm   Post subject: not sure

yeah i guess that kinda works i didn't think to use a oval i was thinking of using drawline hmmm Ahhh its confusing believe me lol i'm sucha noob to this i guess but i was attempting to make them gradually go down u kno? that is like a spec and i attempted to put a delay.... and it didn't seem to work ya kno not sure
Tony




PostPosted: Tue Jun 08, 2004 5:19 pm   Post subject: (No subject)

you might want to get a hold of valor
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
aside




PostPosted: Tue Jun 08, 2004 6:16 pm   Post subject: (No subject)

replace the drawfilloval with the procedure you use to draw your graphics, then use delay() to make the program run slower.
greenapplesodaex




PostPosted: Tue Jun 08, 2004 7:19 pm   Post subject: reply

check out my missile game
http://www.compsci.ca/v2/viewtopic.php?p=51076#51076
MOUSECORD




PostPosted: Tue Jun 08, 2004 8:17 pm   Post subject: sweet

k yeah i got that like... draw.filloval stuff going down like straight down thx for the good start its going good now i think now... i never thought of using ovals... i thought of using lines... i'm not sure if u could use lines also... anyone know if u could use lines too... hmmm quite complecated mb its easier then i think it is... i'm over thinking it i think.... i made it like this.... :

View.Set ("offscreenonly:640;400")
var y : int := maxy
var y1 : int := 21



loop

%exit when y < 0

if y <= 0 then
randint(y1,0,640)
end if

y -= 1
Draw.FillOval (y1, y, 2, 2, red)
delay(10)
%View.Update

end loop


( i know it dosn't work....)
but i'm making it so it makes a random y1 value so it starts in a differnt time each time... but yeah i kno it kinda draws random dots everywhere... i gotta fix that LOL... maybe theres a way to use a line where the lines made at the top ... then it goes down from the one side ... not sure anyone seen that...
aside




PostPosted: Tue Jun 08, 2004 8:49 pm   Post subject: (No subject)

you can just replace the part drawing the oval with any graphics you like, it doesn't matter if it is a line or circle or oval or box, but it would be better if the missle is large enough to see easily.
MOUSECORD




PostPosted: Tue Jun 08, 2004 9:04 pm   Post subject: New Idea

Okay i got a new idea from valors i studied his game and i see that there is a line drawn at the top horizontally... right then the x2 y2 are subtracted right? so it seems to fall from the sky in a matter of speaking do u see ... well check what i've done so far....

code:

View.Set ("offscreenonly:640;400")

var x1, y1 : int
var x2 : int
var y2 : int



loop

    randomize

    randint (x1, 0, 640)
    randint (y1, 400, 500)
    randint (x2, 0, 640)
    y2 := 0

    loop

        drawline (x1, y1, x2 - 1, y2 - 1, 4)
        cls
        delay (1000)
        exit when y2 > 0

    end loop

end loop


Okay so when u run it u don't see anything i can't get it to show the missile falling can neone see why is there a tweek i need to do...???
aside




PostPosted: Tue Jun 08, 2004 9:06 pm   Post subject: (No subject)

you used cls right after you draw the line, so it is erased before it is shown. move the cls before the drawline
MOUSECORD




PostPosted: Tue Jun 08, 2004 9:08 pm   Post subject: hmm

now it just shows the line where its desination will be it doesn't show it going to it... hmmmm
aside




PostPosted: Tue Jun 08, 2004 9:11 pm   Post subject: (No subject)

well, your variables (x and y) are not changing, so of course it will be the same line forever. change the variables.
MOUSECORD




PostPosted: Tue Jun 08, 2004 9:13 pm   Post subject: yeah

yeah but see i'm making x1 and y1 being at a fixed state at the top of the screen and then x2 and y2 are - 1 so that those two points move down the screen u see??? does that make any sense?/?
aside




PostPosted: Tue Jun 08, 2004 9:16 pm   Post subject: (No subject)

yes, you made the x2 and y2 -1 when you are using it, but you are not changing the basic value of them. if x2 is originally 6, then you will have an x value of x2-1=6-1=5 always, use x2:=x2-2 or x2-=2 to actually change the value stored inside the variable
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 2  [ 17 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: