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

Username:   Password: 
 RegisterRegister   
 Allowing the turret head to follow mouse
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Spitfire179




PostPosted: Thu Dec 11, 2008 12:10 pm   Post subject: Allowing the turret head to follow mouse

If i get this to work i can continue


The code
Turing:

var variable, Turret, Turretbase, x, y : int
var left, middle, right, button, Color : int
buttonchoose ("multibutton")
setscreen ("graphics:800,400,nobuttonbar")
Turret := Pic.FileNew ("Turret.bmp")
Turretbase := Pic.FileNew ("Turret Base.bmp")
%----------------------------------%
%---Draw The Turret And Its Base---%
%----------------------------------%
loop
    Pic.Draw (Turret, -40, -82, picMerge)
    Pic.Draw (Turretbase, 0, 0, picUnderMerge)
    mousewhere (x, y, button)
    left := button mod 10
    middle := (button - left) mod 100
    right := button - middle - left
    %-----------------------------%
    %-------Turret Shooting-------%
    %-----------------------------%
    if left = 1 then
        Draw.ThickLine (203, 136, x, y, 11, brightred)
        delay (500)
        cls
    end if
end loop


Is there anyway to have the turret pivot and rotate from its base and follow the location of the mouse to have shots go from the turret barrel to the mouse location?

Mod Edit: Remember to use syntax tags! Smile
code:
[syntax="Turing"]Code Here[/syntax]
Sponsor
Sponsor
Sponsor
sponsor
pkjr92




PostPosted: Thu Dec 11, 2008 12:20 pm   Post subject: Re: Allowing the turret head to follow mouse

Can you attach your pics please?
Spitfire179




PostPosted: Thu Dec 11, 2008 12:26 pm   Post subject: Re: Allowing the turret head to follow mouse

yeh i really dont know how i only know how to add em in one at a time ad as massive sized pics (they all .bmp inages)
Insectoid




PostPosted: Thu Dec 11, 2008 2:04 pm   Post subject: RE:Allowing the turret head to follow mouse

Look at the Perfect Following tutorial. It is slightly different, but will explain picture rotation and stuff. By the way, it involves trigonometry.
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: