Computer Science Canada Help with For loop that gets stuck in my game |
Author: | MOUSECORD [ Thu Jun 10, 2004 7:20 pm ] |
Post subject: | Help with For loop that gets stuck in my game |
Hey i'm making missile command and this part of my game... the anti missile part ----- [code] procedure mouse var mousex, mousey, button : int mousewhere (mousex, mousey, button) if button = 1 then for rad: 1..25 cls drawfilloval (mousex, mousey, rad, rad, 66) delay(25) end for for decreasing rad: 25..1 cls drawfilloval (mousex, mousey, rad, rad, 66) delay(25) end for end if end mouse loop cls mouse delay(25) View.Update end loop [code] if i put something else in the loop say one of my misiles for the game (missile command) the missile lags until the mouse procedure is finished.... is there any way to get around this and still have the same Mouse Procedure affect ... i really need this anyone knows??[/code] |
Author: | Paul [ Thu Jun 10, 2004 7:30 pm ] |
Post subject: | |
put the whole expanding/shrinking circles thingy in the main loop, that is not in its own for loop, and have a the radius decrease / increase using if statements in the loop, while ur other parts run at the same time. Ur other option is to use a process, but some ppl here do not like processes, and for me they make View.Update harder to use. |
Author: | MOUSECORD [ Thu Jun 10, 2004 8:35 pm ] |
Post subject: | |
okay but i'm not sure how to use if statements to make something add smoothly like that only jump to it...? |
Author: | Paul [ Thu Jun 10, 2004 8:55 pm ] | ||||
Post subject: | |||||
Well, I'll give u an example: instead of this, which lags the ball falling:
You have this, which has the ball and click in the same loop
|
Author: | MOUSECORD [ Thu Jun 10, 2004 8:59 pm ] | ||
Post subject: | |||
how about this... it dosn't work but it has potential...
there must be a bug in here can u see it...? |
Author: | aside [ Thu Jun 10, 2004 9:04 pm ] | ||
Post subject: | |||
i'm not sure what are you doing, but i think the bug you are referring to is that it will continuely draw the circle bigger and bigger. try this:
I currently don't have turing available, so i'm only guessing |
Author: | MOUSECORD [ Thu Jun 10, 2004 9:13 pm ] |
Post subject: | |
thanks dude really helped me out man... |
Author: | MOUSECORD [ Thu Jun 10, 2004 9:17 pm ] |
Post subject: | oh |
Oh when i run it now... i can click and hold it and it moves around with the mouse how can i make it so when u click it sticks to that quardinate and does a full around.... u kno??? |
Author: | Paul [ Thu Jun 10, 2004 9:27 pm ] |
Post subject: | |
well, my "check:= true / check:= false" part on the second code box does that in conjunction with variables: drawx and drawy |
Author: | MOUSECORD [ Thu Jun 10, 2004 9:32 pm ] | ||
Post subject: | but | ||
but look if u hold down click... the oval is still there and u can like paint the screen almost ... do u see... this is missile command u know how it goes out then back in staying on a point on the screen.... how can i do that this is my code now...
|
Author: | MOUSECORD [ Thu Jun 10, 2004 9:50 pm ] |
Post subject: | yeah |
yeah when u click it stays on the mouse how to i make it stay on the quardinate u clicked on |