[SOLVED] Views operating independently

A

Andrea Dominante

Guest
Hi, first of all congrats for the brand new, fresh forums :)

Problem: I am making an Android simple platform where commands rotate the room (view_angle) and not the character. Commands are supposed to be simple touch: when the touch is on the right relatively to the character, the room rotates right and viceversa.

Well, I have no idea on how to implement this. The problem comes on touch. I am not able to get the mouse position in an absolute way, but it all comes in relation to the view angle, so basicly when I tell it to rotate right when mouse_x is on the right it gets all glitchy due to the room rotation.

I even tried to to do something like

if mouse_x > view_wport/2
rotate right thing
else if mouse_x < view_wport/2
rotate left thing

Thinking of view_wport as the absolute view of the room as seen on the screen, despite the view angle, but it does not work. So my second attempt is to create two simple image_alpha = 0 buttons that attach to the right and the left of the view port halfway, but problems come due to the fact I have no idea on how to operate on view 0 and 1 as if they were totally independent.

Any help?
 

johnwo

Member
If you want to use the view_wport solution, you can't use mouse_x, but you can use display_mouse_get_x().

If not, you could do something like:

Use two views, one invisible (or with port width/height at 1 and port x/y at -1 or something), say view[1], which should be an exact copy of view[0].

Code:
if mouse_x > view_xview[1] + view_wview[1]/2 then
    view_angle[0]++;

if mouse_x < view_xview[1] + view_wview[1]/2 then
    view_angle[0]--;
Should work.

Cheers!
 
Top