
-----------------------------------
Spitfire179
Thu Dec 11, 2008 12:10 pm

Allowing the turret head to follow mouse
-----------------------------------
If i get this to work i can continue


The code 

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! :) [syntax="Turing"]Code Here[/syntax]

-----------------------------------
pkjr92
Thu Dec 11, 2008 12:20 pm

Re: Allowing the turret head to follow mouse
-----------------------------------
Can you attach your pics please?

-----------------------------------
Spitfire179
Thu Dec 11, 2008 12:26 pm

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
Thu Dec 11, 2008 2:04 pm

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.
