Allowing the turret head to follow mouse
Author |
Message |
Spitfire179
|
Posted: 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! code: | [syntax="Turing"]Code Here[/syntax] |
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
pkjr92
|
Posted: Thu Dec 11, 2008 12:20 pm Post subject: Re: Allowing the turret head to follow mouse |
|
|
Can you attach your pics please? |
|
|
|
|
![](images/spacer.gif) |
Spitfire179
|
Posted: 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) |
|
|
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: 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. |
|
|
|
|
![](images/spacer.gif) |
|
|