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

Username:   Password: 
 RegisterRegister   
 How To Make object shoot
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
hamid14




PostPosted: 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)


Turing:


View.Set ("offscreenonly")
var chars : array char of boolean
var x,y : int := 100

loop
View.Update
cls
drawfillbox (0,0,maxx,maxy,9)
Input.KeyDown (chars)
if chars (KEY_RIGHT_ARROW) then
x := x + 1
end if
if chars (KEY_LEFT_ARROW) then
x := x - 1
end if
drawfilloval (x,y,10,10,red)
end loop




Please specify what version of Turing you are using
4.1
Sponsor
Sponsor
Sponsor
sponsor
Kharybdis




PostPosted: 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.
hamid14




PostPosted: 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?
D_homes




PostPosted: 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....
Kharybdis




PostPosted: 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.
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  [ 5 Posts ]
Jump to:   


Style:  
Search: