Computer Science Canada sniper progam problem |
Author: | Capitano_Canada [ Thu Nov 06, 2008 9:07 am ] |
Post subject: | sniper progam problem |
kk my problem is were i have the draw fill oval how do i make it so when i click in the oval a bullet hole appears i do know how to make noises when i shoot so you dont have to worry about that lol thnx |
Author: | Capitano_Canada [ Thu Nov 06, 2008 9:10 am ] | ||
Post subject: | Re: sniper progam problem | ||
oops lol here is the program |
Author: | pavol [ Thu Nov 06, 2008 1:15 pm ] |
Post subject: | Re: sniper progam problem |
Depending on if you want the bullet holes to stay forever or just one at a time and then disappear...or if you want them to stay until you reload, you will have to then store the x and y positions of each bullet hole in a variable, preferably an array if you have more appearing at once, and then redraw them every time just like you redraw the crosshair. |
Author: | Ledrif [ Thu Nov 06, 2008 5:56 pm ] |
Post subject: | RE:sniper progam problem |
How would you array multiple draws? I would guess make the array changing the variable of the x and y midpoints. I am trying to figure out the coding of this myself aswell however im having difficulty, I had given up and simply am now trying to see if it would work removing the CLS, and simply redraw my moving shape with the background colour. To keep my multiple draws. |
Author: | The_Bean [ Thu Nov 06, 2008 7:41 pm ] |
Post subject: | Re: sniper progam problem |
An easy way of doing it would be with a flexible array. var xHole, yHole : flexible array 1..0 of int We have 2 variables x and y for the center of the hole, and when we declare it, we say 1..0 because there are currently no holes at the beginning. When the user clicks on the screen you now have a shot and a new bullet hole. inside the if statement for checking when a bullet is fired we have to add a new hole to the array of holes This is done by: new xHole , xHole (upper (xHole)) + 1 new yHole , yHole (upper (yHole)) + 1 upper () is used to find the current upper boundary of the array and we add 1 to increase the upper boundary by 1 then still inside the if statement assign these new variables a value xHole (upper (xHole)) := Mouse x yHole (upper (yHole)) := Mouse y then to draw these bullet holes we need a for statement put it after you draw the white hole of the viewing area for i : 1 .. upper(xHole) Draw.Oval(xHole(i),yHole(i),xRadius,yRadius,colour) end for |
Author: | Ledrif [ Thu Nov 06, 2008 10:49 pm ] |
Post subject: | RE:sniper progam problem |
Ah, so as action occurs(shoot,collision,click,move),increase the value then assign the array value to the location. The for statement makes it so that for each array value you draw a independent shape. That example will help me out alot, the turing help referance of flexable arrays is kinda, haha. |
Author: | ecookman [ Fri Nov 07, 2008 9:21 am ] |
Post subject: | RE:sniper progam problem |
yes it works p.s i am working on the program with capitano_Canada please use code tags makkes it easier to read but tyvm |
Author: | Capitano_Canada [ Fri Nov 07, 2008 9:21 am ] |
Post subject: | RE:sniper progam problem |
wow thnx that makes sooo much sence now i can keep working on my program =D |
Author: | SNIPERDUDE [ Sun Nov 09, 2008 7:33 pm ] |
Post subject: | RE:sniper progam problem |
Just for a quick note - Sniper rifles don't shoot that fast, use some sort of a delay system for between shots (that doesn't pause the entire programme) |
Author: | ecookman [ Mon Nov 10, 2008 8:57 am ] |
Post subject: | RE:sniper progam problem |
lol ya it is a semi auto...if you want single fire click quickly and help don't hinder |
Author: | Capitano_Canada [ Mon Nov 10, 2008 11:08 am ] |
Post subject: | RE:sniper progam problem |
oh ya sry about that i changed it because there was no delay so you had to click really fast to only shoot once but i will ad that later |
Author: | Capitano_Canada [ Mon Nov 10, 2008 11:28 am ] |
Post subject: | RE:sniper progam problem |
i need to var x and y Radius right.. if so what do i verify it as? |
Author: | ecookman [ Mon Nov 10, 2008 11:31 am ] |
Post subject: | RE:sniper progam problem |
post the script please so i cna copy it and fix it lol and please the syntax tags |