
-----------------------------------
mobin12
Mon Feb 06, 2012 8:01 pm

How do you make an image rotate using Pic.Rotate and mouse controls?
-----------------------------------
What is it you are trying to achieve?
Want the image to rotate with the mouses position


What is the problem you are having?
can't get the image to rotate using the mouse


setscreen ("graphics:450;300,nobuttonbar,offscreenonly")

var player : array 1 .. 2 of int
player (1) := 225
player (2) := 150
var chars : array char of boolean
%Mouse Controls
var mx, my, mb : int
%Picture File
var PlayerImage : int := Pic.FileNew ("Player.jpg")

loop
    Pic.Draw (PlayerImage, player (1), player (2), picMerge)
    Input.KeyDown (chars)
    if chars ('w') and player (2) < 282 then
        player (2) := player (2) + 1
    end if
    if chars ('s') and player (2) > 17 then
        player (2) := player (2) - 1
    end if
    if chars ('a') and player (1) > 17 then
        player (1) := player (1) - 1
    end if
    if chars ('d') and player (1) < 432 then
        player (1) := player (1) + 1
    end if
    View.Update
    Time.Delay (5)
    cls
end loop




Please specify what version of Turing you are using
Turing 1.4.1

-----------------------------------
Dreadnought
Mon Feb 06, 2012 8:54 pm

Re: How do you make an image rotate using Pic.Rotate and mouse controls?
-----------------------------------
What have you tried? There's no evidence in the code you posted that you have tried anything.

Read the documentation on [tdoc]Mouse.Where[/tdoc] and [tdoc]Pic.Rotate[/tdoc] if you don't know where to start. Also, you will need some understanding of trigonometry (nothing too complicated though).

-----------------------------------
mobin12
Tue Feb 07, 2012 5:24 pm

RE:How do you make an image rotate using Pic.Rotate and mouse controls?
-----------------------------------
I know trigonometry but i dont know how i would use it here.

-----------------------------------
mirhagk
Tue Feb 07, 2012 5:48 pm

RE:How do you make an image rotate using Pic.Rotate and mouse controls?
-----------------------------------
You need to determine the angle that you need to rotate the picture. The x and y of your mouse, minus the x and y of the picture, makes a nice little triangle

-----------------------------------
mobin12
Wed Feb 08, 2012 8:22 pm

RE:How do you make an image rotate using Pic.Rotate and mouse controls?
-----------------------------------
i dont understand. that is only two points thats not a triangle.

-----------------------------------
mirhagk
Wed Feb 08, 2012 9:11 pm

Re: How do you make an image rotate using Pic.Rotate and mouse controls?
-----------------------------------
http://i44.tinypic.com/ao2l1y.png

That should help you[/img]

-----------------------------------
mobin12
Mon Feb 13, 2012 3:32 pm

RE:How do you make an image rotate using Pic.Rotate and mouse controls?
-----------------------------------
i cant see the image

-----------------------------------
Dreadnought
Mon Feb 13, 2012 4:04 pm

Re: How do you make an image rotate using Pic.Rotate and mouse controls?
-----------------------------------
It's odd that you can't see the picture, here's my attempt at representing it in in text. Picture the '/' as a diagonal line and the 'v' and '^' as arrows.

[code]                                         v (x, y) of mouse
                                        /|
                                      /  |
                                    /    |
                                  /      | 