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

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




PostPosted: Sat Nov 12, 2005 2:31 pm   Post subject: shooting game help

I am making a shooting game. you have to shoot random targets that come up on the screen. The problem is, is that you can press the shoot button multiple times and hit the same target and rack up the points. How do you fix this?
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Sat Nov 12, 2005 3:05 pm   Post subject: (No subject)

Once you shoot the target, remove it. This could be done a number of ways: set a boolean flag, which represents its life, to false; remove its element from a flexible array of enemies; set the pointer, which points to the monster class (or whatever you're calling it), to nil.
GlobeTrotter




PostPosted: Sat Nov 12, 2005 3:18 pm   Post subject: (No subject)

You could also use a counter variable to ensure that the user can only shoot once every so often.
Flikerator




PostPosted: Sat Nov 12, 2005 5:05 pm   Post subject: (No subject)

You could also use a "cooldown" between shots, limiting how fast you can shoot.
iker




PostPosted: Sun Nov 13, 2005 2:51 pm   Post subject: (No subject)

Quote:
You could also use a counter variable to ensure that the user can only shoot once every so often.

Quote:
You could also use a "cooldown" between shots, limiting how fast you can shoot.

same thing...
anyways I'd say do what cervantes is saying, create a boolean flag on the targets such as
code:

var hit1 : boolean := false
var point : int := 0
loop
    drawbox (10,10,20,20,blue)
    %shot taken
    %check if box is hit
    if hit1 = false then
        if x>10 blablabla then
            hit1:=true
            point += 1
        end if
    end if
end loop


anyways if you don't get what I'm saying, just ask
Cervantes




PostPosted: Sun Nov 13, 2005 4:04 pm   Post subject: (No subject)

iker wrote:

anyways I'd say do what cervantes is saying, create a boolean flag on the targets

I made the assumption that enemies are killed in one hit. In more complex games, this may not be the case, and the other suggestion(s) is the way to go.

Also, just a comment on the code.
code:
if x>10 blablabla then

Now, I'm not going to comment on the fact that this raises an error Wink.
Since this is for teaching purposes, its generally a bad idea to use blabla's. Without previous knowledge on the topic, I wouldn't be sure what you were intending to do with this line. Especially since you already seem to have "chedk[ed] if box is hit".
sniper




PostPosted: Mon Nov 14, 2005 8:21 am   Post subject: (No subject)

to Iker
quote "Code:

var hit1 : boolean := false
var point : int := 0
loop
drawbox (10,10,20,20,blue)
%shot taken
%check if box is hit
if hit1 = false then
if x>10 blablabla then
hit1:=true
point += 1
end if
end if
end loop

I understand some of it but would you please type in the whole code just to give me an idea cause I don't understand the "blablabla"?
thanks though.
Albrecd




PostPosted: Mon Nov 14, 2005 9:42 am   Post subject: (No subject)

I think that by x> 10 blablabla he's doing the colision detection.

Ex:
code:
if x_shot > x_target and x_shot < x_target + target_width and
y_shot > y_target and y_shot < y_target + target_height then
hit := true


but I could be wrong... in any case, this should work.[/quote]
Sponsor
Sponsor
Sponsor
sponsor
iker




PostPosted: Mon Nov 14, 2005 7:05 pm   Post subject: (No subject)

nope, your right, sry I didn't get around to typing that in, my rents were rushing me off of my computer, but yah, its just the collision detection to see if the mouse is in the range of being able to shoot the target...
the actual code would be
code:


var hit1 : boolean := false
var point : int := 0
var x, y, button : int
drawbox (10, 10, 20, 20, blue)
loop
    Mouse.Where (x, y, button)
    if button = 1 then
        if hit1 = false then
            if x > 10 and x < 20 and y > 10 and y < 20 then
                %i'm using these values because those are the dimensions of the
                %box
                hit1 := true
                point += 1
            end if
        end if
    end if
    if hit1 = true then
        cls
        locate (1, 1)
        put point ..
        delay (1000)
        hit1 := false
        drawbox (10, 10, 20, 20, blue)
    end if
    locate (1, 1)
    put point ..
end loop

in this code, it will set a delay time of 1000 before you may shoot again at the same target

anyways, hopefully that helped alot more Very Happy
sniper




PostPosted: Mon Nov 14, 2005 9:43 pm   Post subject: (No subject)

alright thanks dude, it helped alot thanks !!
sniper




PostPosted: Tue Nov 15, 2005 9:02 am   Post subject: (No subject)

this is my game any help for only allowing the shooter to shoot once?

setscreen ("graphics")
var x, y, y2, x3 : int
var key : array char of boolean
var chars : array char of boolean
x := 100
y := 100
var x2, y3 : real
var count : int
var ctr : int
var a, b : int
var button: int
x := 200
x3 := 15
y := 100
y2 := 15
x2 := Rand.Int (1, maxx - 1)
y3 := Rand.Int (1, maxy - 1)
ctr := 0
count := 0

View.Set ("offscreenonly")
loop


delay (8)
Input.KeyDown (chars)
if ctr = 100 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 100 and ctr <= 200 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if

if ctr = 200 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
end if

if ctr >= 200 and ctr <= 300 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 300 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if

if ctr >= 300 and ctr <= 400 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 400 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if

if ctr >= 400 and ctr <= 500 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 500 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if

if ctr >= 500 and ctr <= 600 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 600 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if

if ctr >= 600 and ctr <= 700 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if

if ctr = 700 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if

if ctr >= 700 and ctr <= 800 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 800 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if

if ctr >= 800 and ctr <= 900 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 900 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if

if ctr >= 900 and ctr <= 1000 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 1000 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if

if ctr >= 1000 and ctr <= 1100 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 1100 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if

if ctr >= 1100 and ctr <= 1200 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 1200 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if

if ctr >= 1200 and ctr <= 1300 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 1300 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if

if ctr >= 1300 and ctr <= 1400 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 1400 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if

if ctr >= 1400 and ctr <= 1500 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 1500 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)


end if
if ctr >= 1500 and ctr <= 1600 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 1600 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 1600 and ctr <= 1700 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 1700 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 1700 and ctr <= 1800 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 1800 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 1800 and ctr <= 1900 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 1800 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 1800 and ctr <= 1900 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 1800 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 1800 and ctr <= 1900 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 1900 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 1900 and ctr <= 2000 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 1900 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 1900 and ctr <= 2000 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 1900 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 1900 and ctr <= 2000 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if

if ctr = 2000 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 2000 and ctr <= 2100 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 2000 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 2000 and ctr <= 2100 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 2100 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 2100 and ctr <= 2200 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 2200 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 2200 and ctr <= 2300 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 2300 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 2300 and ctr <= 2400 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 2400 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 2400 and ctr <= 2500 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 2500 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 2500 and ctr <= 2600 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if chars (KEY_UP_ARROW) and y < 400 then
drawoval (x, y, x3, y2, white)
y := y + 7

drawoval (x, y, x3, y2, black)
elsif chars (KEY_DOWN_ARROW) and y2 > 0 then
drawoval (x, y, x3, y2, white)
y := y - 7

drawoval (x, y, x3, y2, black)
elsif chars (KEY_RIGHT_ARROW) and y < 400 then
drawoval (x, y, x3, y2, white)
x := x + 7

drawoval (x, y, x3, y2, black)

elsif chars (KEY_LEFT_ARROW) and y2 > 0 then
drawoval (x, y, x3, y2, white)
x := x - 7

drawoval (x, y, x3, y2, black)
end if
View.Update
drawoval (x, y, 15, 15, black)
ctr := ctr + 1
exit when ctr = 2600
end loop

put count
if count = 0 then
put "0% shooting, never play again"
end if
if count = 1 then
put "4% shooting,you should quit right now"
end if
if count = 2 then
put "8% shooting,you suck"
end if
if count = 3 then
put "12% shooting,you really need practice"
end if
if count = 4 then
put "15% shooting,you still suck"
end if
if count = 5 then
put "19% shooting,nothing to say but YOU SUCK!"
end if
if count = 6 then
put "23% shooting,you need practice"
end if
if count = 7 then
put "27% shooting,you still need practice"
end if
if count = 8 then
put "31% shooting,you're not practicing enough"
end if
if count = 9 then
put "35% shooting,you need practice"
end if
if count = 10 then
put "38% shooting,you need practice"
end if
if count = 11 then
put "42% shooting,you need practice"
end if
if count = 12 then
put "46% shooting ..."
end if
if count = 13 then
put "50% shooting, you passed"
end if
if count = 14 then
put "54% shooting..."
end if
if count = 15 then
put "58% shooting..."
end if
if count = 16 then
put "62% shooting..."
end if
if count = 17 then
put "65% shooting..."
end if
if count = 18 then
put "69% shooting..."
end if
if count = 19 then
put "73% shooting, ok"
end if
if count = 20 then
put "77% shooting, you're getting there"
end if
if count = 21 then
put "81% shooting, nice"
end if
if count = 22 then
put "85% shooting, nicely done"
end if
if count = 23 then
put "88% shooting, well done!"
end if
if count = 24 then
put "92% shooting, almost perfect!!"
end if
if count = 25 then
put "96% shooting, excellent"
end if
if count = 26 then
put " 100% shooting, you're too good"
end if
sniper




PostPosted: Tue Nov 15, 2005 9:04 am   Post subject: (No subject)

this is my game any help for only allowing the shooter to shoot once?

setscreen ("graphics")
var x, y, y2, x3 : int
var key : array char of boolean
var chars : array char of boolean
x := 100
y := 100
var x2, y3 : real
var count : int
var ctr : int
var a, b : int
var button: int
x := 200
x3 := 15
y := 100
y2 := 15
x2 := Rand.Int (1, maxx - 1)
y3 := Rand.Int (1, maxy - 1)
ctr := 0
count := 0

View.Set ("offscreenonly")
loop


delay (8)
Input.KeyDown (chars)
if ctr = 100 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 100 and ctr <= 200 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if

if ctr = 200 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
end if

if ctr >= 200 and ctr <= 300 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 300 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if

if ctr >= 300 and ctr <= 400 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 400 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if

if ctr >= 400 and ctr <= 500 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 500 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if

if ctr >= 500 and ctr <= 600 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 600 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if

if ctr >= 600 and ctr <= 700 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if

if ctr = 700 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if

if ctr >= 700 and ctr <= 800 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 800 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if

if ctr >= 800 and ctr <= 900 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 900 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if

if ctr >= 900 and ctr <= 1000 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 1000 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if

if ctr >= 1000 and ctr <= 1100 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 1100 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if

if ctr >= 1100 and ctr <= 1200 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 1200 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if

if ctr >= 1200 and ctr <= 1300 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 1300 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if

if ctr >= 1300 and ctr <= 1400 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 1400 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if

if ctr >= 1400 and ctr <= 1500 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 1500 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)


end if
if ctr >= 1500 and ctr <= 1600 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 1600 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 1600 and ctr <= 1700 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 1700 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 1700 and ctr <= 1800 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 1800 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 1800 and ctr <= 1900 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 1800 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 1800 and ctr <= 1900 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 1800 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 1800 and ctr <= 1900 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 1900 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 1900 and ctr <= 2000 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 1900 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 1900 and ctr <= 2000 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 1900 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 1900 and ctr <= 2000 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if

if ctr = 2000 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 2000 and ctr <= 2100 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 2000 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 2000 and ctr <= 2100 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 2100 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 2100 and ctr <= 2200 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 2200 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 2200 and ctr <= 2300 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 2300 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 2300 and ctr <= 2400 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 2400 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 2400 and ctr <= 2500 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if ctr = 2500 then
randint (a, 50, 590)
randint (b, 50, 350)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)

end if
if ctr >= 2500 and ctr <= 2600 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end if
if chars (KEY_UP_ARROW) and y < 400 then
drawoval (x, y, x3, y2, white)
y := y + 7

drawoval (x, y, x3, y2, black)
elsif chars (KEY_DOWN_ARROW) and y2 > 0 then
drawoval (x, y, x3, y2, white)
y := y - 7

drawoval (x, y, x3, y2, black)
elsif chars (KEY_RIGHT_ARROW) and y < 400 then
drawoval (x, y, x3, y2, white)
x := x + 7

drawoval (x, y, x3, y2, black)

elsif chars (KEY_LEFT_ARROW) and y2 > 0 then
drawoval (x, y, x3, y2, white)
x := x - 7

drawoval (x, y, x3, y2, black)
end if
View.Update
drawoval (x, y, 15, 15, black)
ctr := ctr + 1
exit when ctr = 2600
end loop

put count
if count = 0 then
put "0% shooting, never play again"
end if
if count = 1 then
put "4% shooting,you should quit right now"
end if
if count = 2 then
put "8% shooting,you suck"
end if
if count = 3 then
put "12% shooting,you really need practice"
end if
if count = 4 then
put "15% shooting,you still suck"
end if
if count = 5 then
put "19% shooting,nothing to say but YOU SUCK!"
end if
if count = 6 then
put "23% shooting,you need practice"
end if
if count = 7 then
put "27% shooting,you still need practice"
end if
if count = 8 then
put "31% shooting,you're not practicing enough"
end if
if count = 9 then
put "35% shooting,you need practice"
end if
if count = 10 then
put "38% shooting,you need practice"
end if
if count = 11 then
put "42% shooting,you need practice"
end if
if count = 12 then
put "46% shooting ..."
end if
if count = 13 then
put "50% shooting, you passed"
end if
if count = 14 then
put "54% shooting..."
end if
if count = 15 then
put "58% shooting..."
end if
if count = 16 then
put "62% shooting..."
end if
if count = 17 then
put "65% shooting..."
end if
if count = 18 then
put "69% shooting..."
end if
if count = 19 then
put "73% shooting, ok"
end if
if count = 20 then
put "77% shooting, you're getting there"
end if
if count = 21 then
put "81% shooting, nice"
end if
if count = 22 then
put "85% shooting, nicely done"
end if
if count = 23 then
put "88% shooting, well done!"
end if
if count = 24 then
put "92% shooting, almost perfect!!"
end if
if count = 25 then
put "96% shooting, excellent"
end if
if count = 26 then
put " 100% shooting, you're too good"
end if
ZeroPaladn




PostPosted: Tue Nov 15, 2005 10:02 am   Post subject: (No subject)

whoa!!!!! too much code!!!!!!! just a few suggestions...

(1) when putting up this much code, upload the .t file instead, so you dont ahve to double post, and "flood" the forums.
(2) use the code | /code tags when posting code, this saves room as well as making it readable.
(3) for the love of god use procedures!
code:

procedure shootingTargets
for i : 200 .. 2600 by 100
if ctr >= i and ctr <= i + 100 then
cls
drawoval (x, y, 15, 15, black)
drawfilloval (a, b, 50, 50, brightred)
drawfilloval (a, b, 40, 40, white)
drawfilloval (a, b, 30, 30, brightred)
drawfilloval (a, b, 20, 20, white)
drawfilloval (a, b, 10, 10, brightred)
if chars (KEY_ALT) and x <= (a + 50) and x >= (a - 50) and y <= (b + 50) and y >= (b - 50) then
count := count + 1
Music.PlayFile ("gunshot.wav")
end if
end for
end shootingTargets


i flawed the code so you jsut cant copy and paste, but you get the idea, this should lessen about 2k lines of code for ya Laughing[/code]
do_pete




PostPosted: Wed Nov 16, 2005 12:02 pm   Post subject: (No subject)

I took me 2 minutes just to select the code Confused
The_Triangle




PostPosted: Fri Nov 18, 2005 8:59 am   Post subject: (No subject)

do_pete wrote:
I took me 2 minutes just to select the code Confused


clean ur mouse every once in a while Razz
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  [ 15 Posts ]
Jump to:   


Style:  
Search: