Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Player Direction moving to the direction of dropping object (https://forums.graalonline.com/forums/showthread.php?t=79756)

Stryke 05-16-2008 11:53 PM

Player Direction moving to the direction of dropping object
 
Like in Era, your player's direction moves to the direction of the object that is to be dropped. How would I do this? I've tried these:

PHP Code:

    if(DragItem.player.y)player.dir 0;
    if(
DragItem.player.x)player.dir 1;
    if(
DragItem.player.y)player.dir 2;
    if(
DragItem.player.x)player.dir 3

PHP Code:

player.getdir(DragItem.x,DragItem.y); 

PHP Code:

getdir(DragItem.x,DragItem.y); 

It'd be nice if there was a function like player.dir.pointdirection(obj);

Robin 05-16-2008 11:58 PM

there is getdir, it works on dx and dy.
PHP Code:

dx dragitem.player.x;
dy dragitem.player.y;
player.dir getdir(dx,dy); 

if the player is pointing the opposite way, reverse the dragitem and player, can't remember which way it's supposed to go and I'm about to go to bed :P

Stryke 05-17-2008 12:06 AM

I tried:

PHP Code:

temp.dx DragItem.player.x;
temp.dy DragItem.player.y;
player.dir getdir(temp.dxtemp.dy); 

It only works when the DragItem is far away from the player.

EDIT: SOLVED!!!

PHP Code:

temp.sx screenx(player.x,player.y);
temp.sy screeny(player.x,player.y);
temp.dx DragItem.temp.sx;
temp.dy DragItem.temp.sy;
player.dir getdir(temp.dxtemp.dy); 

This fixed it.

Dan 05-17-2008 12:08 AM

Try this;
PHP Code:

temp.dx worldx(DragItem.x,0) - player.x;
temp.dy worldy(0,DragItem.y) - player.y;
player.dir getdir(temp.dxtemp.dy); 


DustyPorViva 05-17-2008 12:13 AM

If the player is dragging it, couldn't you simply use mousex/y?

[email protected] 05-17-2008 12:16 AM

no, he's wanting to change the players direction depending on where the mouse is

Dan 05-17-2008 12:16 AM

Quote:

Originally Posted by DustyPorViva (Post 1391154)
If the player is dragging it, couldn't you simply use mousex/y?

Good idea. Depends on if it is detecting the position of the item when clicking (like some item systems make the item icon center at mousex and mousey, and some don't).

DustyPorViva 05-17-2008 12:20 AM

Quote:

Originally Posted by [email protected] (Post 1391158)
no, he's wanting to change the players direction depending on where the mouse is

Exactly.
Instead of worrying about using a GUI position and translating it to level coordinates, simply use mousex/y.

[email protected] 05-17-2008 08:05 AM

oh silly me, yes you can haha


All times are GMT +2. The time now is 08:25 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.