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

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




PostPosted: Sat May 22, 2010 7:45 pm   Post subject: shooting help part 2

What is it you are trying to achieve?
Im trying to add shooting to my game

What is the problem you are having?
can't seem to implement it in the game


Describe what you have tried to solve this problem
everything i can think of, and the farthest ive gotten is having him on the screen and when i press the shoot button the bullet shoots on a white background


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
if any code is needed ill pm it.

Turing:


<Add your code here>



Please specify what version of Turing you are using
4.1.1
Sponsor
Sponsor
Sponsor
sponsor
Monduman11




PostPosted: Sat May 22, 2010 7:46 pm   Post subject: Re: shooting help part 2

i have the shooting working fine seperately. i can shoot multiple things at the same time the only thing i cant seem to do is get it working in the game.
i dont know where to add the fork bulletshoot
DemonWasp




PostPosted: Sat May 22, 2010 10:52 pm   Post subject: RE:shooting help part 2

Don't fork, ever. You should be able to do animation of multiple objects without using fork. Doing so will make your life an order of magnitude easier.
TerranceN




PostPosted: Sat May 22, 2010 11:16 pm   Post subject: RE:shooting help part 2

Instead of creating separate processes with fork, just do everything in one loop, and use functions to group chunks of code together (to keep it from becoming a mess). Something like this:

Turing:
View.Set("graphics:500;500,offscreenonly,nobuttonbar,title:The Game")

var x1 : int := 1
var x2 : int := 499

procedure Update()
    % move first circle
    x1 += 1
   
    % move second circle
    x2 -= 1
end Update

procedure Draw_() /* I put the underscore there because the name
                   * Draw is already used for a pre-defined module
                   */

    cls()
   
    % draw first circle
    Draw.Oval(x1, 150, 10, 10, black)
   
    % draw second circle
    Draw.Oval(x2, 350, 10, 10, black)
   
    View.Update()
end Draw_

loop
    Update()
    Draw_()
    Time.DelaySinceLast(33)
end loop


Hope that helps.
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  [ 4 Posts ]
Jump to:   


Style:  
Search: