Target Game Problems
Author |
Message |
Hemin
|
Posted: Sat Jan 19, 2008 10:26 am Post subject: Target Game Problems |
|
|
I am having problems with my target game here are some of the
Need Help fixing:
-Mousewhere lags while target moves fine
-need help making a countdown timer
- make ouse click target and make it disapper
- point if you get the target 1 point and if you miss minus 1
- target moves faster evertime the player gets it
here my code so far
%Hemin Desai
%Paterson
%11/1/08
%Target Game
var counter: int := 0
var x,y,b:int
var xx,yy:int
loop
randint(xx,100,maxx-100)
randint(yy,100,maxy-100)
drawfilloval (xx,yy,30,30,12)
drawfilloval (xx,yy,20,20,white)
drawfilloval (xx,yy,10,10,12)
mousewhere(x,y,b)
drawfilloval(x,y,10,10,black)
drawfilloval(x,y,5,5,0)
drawfilloval(x,y,2,2,black)
delay (200)
drawfilloval (xx,yy,30,30,0)
drawfilloval(x,y,10,10,0)
end loop |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
TokenHerbz
![](http://compsci.ca/v3/uploads/user_avatars/717170395558e628d9452b.jpg)
|
Posted: Sat Jan 19, 2008 11:38 am Post subject: RE:Target Game Problems |
|
|
You haven't even attempted this.... People on this website like to help if we see you've put effort in. At least show us some code that doesn't work, it's a lot better then no code at all.
Here are some tips though.
As for why your mousewhere lags, its that delay you have in the middle of your loop. Try to remove it, add this following to the end of your code just about your "end loop".
code: |
View.Update
delay(20)
cls
|
Now your targets should be moving all over the place extremely fast, but theres a way to put that into a procedure to redraw its chords after a certain amount of time.
as for a countdown time, it should be basic enough, First i want you to loop up "time" in the turing help, and press F9- and attempt it yourself first.
tip for using mousewhere click. The basic part you'll need to know: try the following
code: |
var mx, my, mb : int %%vars, mouseX, mouseY, mouseButton vars.
loop
Mouse.Where (mx, my, mb) %%tells prog we are useing mouse vars
if mb = 1 then %%if mousebutton is activated then
put "Mouse Button Clicked Down" %%show its activated
else
put "Mouse Button Not Clicked" %%else its not
end if
delay (20) %%i always like my 20delay :S
cls
end loop
|
As you see, we delare a var to use, if mousebutton is clicked then we can have somthing done, in your case either miss or hit the target. To find out if it hit or miss, do collision programming, again try it first and post your code.
now you want the target to move faster every time its hit, again this could work with my suggestion of having it placed in a proc with rules before its called to be moved. Just have this on a timer which deducts every time its hit. Try it out first
Anyways hopefully this is a little assistance..
edit for last suggestion.
name your variables a little bit better too. its good to get into a habbit for that. |
|
|
|
|
![](images/spacer.gif) |
|
|