Shooting game: what is not working?
Author |
Message |
evildaddy911
|
Posted: Tue Dec 06, 2011 4:08 pm Post subject: Shooting game: what is not working? |
|
|
What is it you are trying to achieve?
shooting game, click to shoot
What is the problem you are having?
When I click to shoot, nothing happens
Describe what you have tried to solve this problem
I have no idea what is going wrong in order to fix it
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
See below
Please specify what version of Turing you are using
4.1.1
Description: |
a,d (left/right); w(jump); click(shoot) |
|
![](http://compsci.ca/v3/pafiledb/images/icons/clip.gif) Download |
Filename: |
basic game.t |
Filesize: |
3.59 KB |
Downloaded: |
73 Time(s) |
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Dreadnought
|
Posted: Tue Dec 06, 2011 4:39 pm Post subject: Re: Shooting game: what is not working? |
|
|
When you draw your "bullet" with
drawoval (round (blt (i).x), round (blt (i).y), 10000, 10000, black)
You're making a circle of radius 10000 pixels. That might be somewhere around 10 times the width of your screen.
|
|
|
|
|
![](images/spacer.gif) |
evildaddy911
|
Posted: Tue Dec 06, 2011 5:00 pm Post subject: RE:Shooting game: what is not working? |
|
|
yeah, i was using that to figure out where my bullet was, but I changed that to 10 and determined that it was in the bottom left corner... ignore that part
|
|
|
|
|
![](images/spacer.gif) |
Raknarg
![](http://compsci.ca/v3/uploads/user_avatars/3745510004d8be6689b92f.jpg)
|
Posted: Tue Dec 06, 2011 7:12 pm Post subject: RE:Shooting game: what is not working? |
|
|
var blt : array 1 .. round (Math.Distance (25, 25, 500 - 25, 500) / speed) of shot
What;s with that upper bound, first of all?
|
|
|
|
|
![](images/spacer.gif) |
Dreadnought
|
Posted: Tue Dec 06, 2011 7:25 pm Post subject: Re: Shooting game: what is not working? |
|
|
I think he's calculated the maximum number of bullets he could ever possibly have on screen at any given time. The distance from (25,25) to (475,500) is probably the diagonal distance between opposite corners of the level zone. Since he only creates one bullet per frame, and he moves each bullet 5 pixels per frame, the most bullets he could ever have on screen is the distance divided by the displacement per frame (5 pixels).
|
|
|
|
|
![](images/spacer.gif) |
evildaddy911
|
Posted: Wed Dec 07, 2011 9:29 am Post subject: RE:Shooting game: what is not working? |
|
|
exactly dreadnought
|
|
|
|
|
![](images/spacer.gif) |
|
|