How To Make object shoot
Author |
Message |
hamid14
![](http://compsci.ca/v3/uploads/user_avatars/12047066924bcf67a12efdb.png)
|
Posted: Fri Nov 27, 2009 9:14 pm Post subject: How To Make object shoot |
|
|
What is it you are trying to achieve?
Trying to make a circle shoot a bullet, which is another smaller circle
What is the problem you are having?
Can't figure out how to draw a circle that keeps moving and appears from the x of the shooter
Describe what you have tried to solve this problem
I've tried procedures, using more than 1 loop, drawing a oval at the x and using + 1 in a loop
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Please specify what version of Turing you are using
4.1 |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Kharybdis
![](http://compsci.ca/v3/uploads/user_avatars/111642592477ec7e78e574.gif)
|
Posted: Fri Nov 27, 2009 9:42 pm Post subject: Re: How To Make object shoot |
|
|
You need to make a procedure that draws the smaller circle (bullet)
then, in your main loop, when the person presses the fire or shoot button or w/e, you put the x value that the bullet starts from into the procedure, and then as the main loop continues, continue drawing the x values of the bullet.
so..
Turing: |
procedure Small_Bullet ( x : int)
drawfillcircle (blah blah blah )
end Small_Bullet
%main
loop
drawfillPerson
if shoot then
Small_Bullet (value of x )
x += 1
end if
View.Update
end loop |
You gotta think of programming this keeping in mind that you have to change the position of the person (even if there is no change) and the bullet, and then update everything simultaneously. |
|
|
|
|
![](images/spacer.gif) |
hamid14
![](http://compsci.ca/v3/uploads/user_avatars/12047066924bcf67a12efdb.png)
|
Posted: Fri Nov 27, 2009 9:56 pm Post subject: Re: How To Make object shoot |
|
|
that doesnt work. It says 'x' has not been declared? |
|
|
|
|
![](images/spacer.gif) |
D_homes
![](http://compsci.ca/v3/uploads/user_avatars/14338014624af713596354e.jpg)
|
Posted: Fri Nov 27, 2009 10:08 pm Post subject: Re: How To Make object shoot |
|
|
hamid14 @ Fri Nov 27, 2009 9:56 pm wrote: that doesnt work. It says 'x' has not been declared?
Then declare x.... |
|
|
|
|
![](images/spacer.gif) |
Kharybdis
![](http://compsci.ca/v3/uploads/user_avatars/111642592477ec7e78e574.gif)
|
Posted: Sat Nov 28, 2009 11:57 pm Post subject: Re: How To Make object shoot |
|
|
hamid14 @ Fri Nov 27, 2009 9:56 pm wrote: that doesnt work. It says 'x' has not been declared?
What i wrote was more on the line of pseudocode. The various things that would make it work would require you to have full knowledge of how the procedures/system works. Sorry for any confusion. |
|
|
|
|
![](images/spacer.gif) |
|
|