
-----------------------------------
jeo77
Tue Dec 13, 2005 9:00 am

Pic.Rotate Help
-----------------------------------
Hey, just wanted to say this before I pleed for help - great forums you guys have got running here, come in real handy when you get stuck and are sitting here cursing at the monitor. Heh.

Anyways, Im making a small artillery game, and im trying to figure out how to rotate the turret of the tank, it's a seperate picture, and I can get it to rotate, but it rotates on a wierd pivot point, I need the pivot point on the bottom center of the turret, any ideas? 

This is what I got so far,


View.Set ("graphics:1000;700,nobuttonbar")


var player1turret : int
player1turret := Pic.FileNew ("barrel.jpg")




var p1turretmove : string (1)
var p1turretangle : int
p1turretangle := 90
loop
    getch (p1turretmove)
    if ord (p1turretmove) = 203 then
        p1turretangle := p1turretangle - 10

        var p1turretleft : int := Pic.Rotate (player1turret, p1turretangle, 15, 12)
        Pic.Draw (p1turretleft, 100, 100, picCopy)

    elsif
            ord (p1turretmove) = 205 then
        p1turretangle := p1turretangle + 10

        var p1turretleft : int := Pic.Rotate (player1turret, p1turretangle, 15, 12)
        Pic.Draw (p1turretleft, 100, 100, picCopy)


    end if

end loop


-----------------------------------
Tony
Tue Dec 13, 2005 10:10 am


-----------------------------------
well

Pic.Rotate (picID, angle, x, y : int) : int

Where x,y is the pivot point relative to the bottom left of the image. If it rotates weirdly, try adjusting those values.

-----------------------------------
do_pete
Tue Dec 13, 2005 11:07 am


-----------------------------------
Yes and pre rotate your pictures and store them in an array, It'll make it go much faster on slower computers
