|
|
Re: how to get a pointer from a clicked entity?
[Re: Conscript]
#389627
12/16/11 13:25
12/16/11 13:25
|
Joined: Jul 2005
Posts: 187
lostzac
Member
|
Member
Joined: Jul 2005
Posts: 187
|
If I am understanding what you are trying to do is get your man to move to the position that you click...If so read up on Aum 34...You will have to update the code to fit your version of GS..but it should give you the basic understanding of how to do it....
John C Leutz II
|
|
|
Re: how to get a pointer from a clicked entity?
[Re: Conscript]
#389632
12/16/11 13:45
12/16/11 13:45
|
Joined: Jul 2005
Posts: 187
lostzac
Member
|
Member
Joined: Jul 2005
Posts: 187
|
Not an issues glad I could help
John C Leutz II
|
|
|
Re: how to get a pointer from a clicked entity?
[Re: Conscript]
#389634
12/16/11 13:49
12/16/11 13:49
|
Joined: Jul 2005
Posts: 187
lostzac
Member
|
Member
Joined: Jul 2005
Posts: 187
|
Laugh I think its all the way back to A5....It is not that hard to update the code...If you would like I can do it for ya real quick
John C Leutz II
|
|
|
Re: how to get a pointer from a clicked entity?
[Re: Conscript]
#389639
12/16/11 14:08
12/16/11 14:08
|
Joined: Jul 2005
Posts: 187
lostzac
Member
|
Member
Joined: Jul 2005
Posts: 187
|
Hmmm I thought I replied to this....Yeah pm me with what you want and Ill be glad to help
John C Leutz II
|
|
|
Re: how to get a pointer from a clicked entity?
[Re: lostzac]
#389719
12/17/11 14:25
12/17/11 14:25
|
Joined: Dec 2009
Posts: 128 China
frankjiang
Member
|
Member
Joined: Dec 2009
Posts: 128
China
|
hey ,Conscript , this is my game project`s code, you can read it and know how to click any entity.
void mouseEvent()
{
STRING* _s = NULL;
C_LINK* _link = NULL;
PANEL* p = NULL;
ENTITY* ent = NULL;
while(1)
{
if (mouse_left) // left button pressed over panel?
{
p = mouse_panel;
if(p!=NULL)
{
_link = &(p->link);
if(_link->name != NULL )
{
_s = str_create(_link->name);
if(str_cmp(_s,Name_InputText1) == 1 )
{
lockTextCom(0);
}
else if(str_cmp(_s,Name_PickPanel1) == 1 )
{
lockTextCom(1);
}
ptr_remove(_s);
}
}
ent = mouse_ent;
if(ent!=NULL)
{
_link = &(ent->link);
if(_link->name != NULL )
{
_s = str_create(_link->name);
if(str_cmp(_s,Name_Role1) == 1)
{
logS("you hit role by mouse left");
}
ptr_remove(_s);
}
}
}
wait(1);
}
}
development 3d game is interesting!
|
|
|
Re: how to get a pointer from a clicked entity?
[Re: frankjiang]
#389860
12/19/11 05:11
12/19/11 05:11
|
Joined: Dec 2011
Posts: 5
Conscript
OP
Newbie
|
OP
Newbie
Joined: Dec 2011
Posts: 5
|
hey... something's wrong... i'd check the action.. because the error says "Crash in unit SYS"
action unit() //animation of "walk" for this entity { my.emask |= ENABLE_CLICK; my.event = scan_ent;
attack_percent += 3*time_step; ent_animate(me,"attack",attack_percent,ANM_CYCLE); while(1) { if(my.move == 1) { walk_percent += 3*time_step ; ent_animate(me,"walk",walk_percent,ANM_CYCLE); c_move(me,vector(Distance,0,0),vector(0,0,0),IGNORE_PASSABLE | GLIDE);
if(vec_dist(Distance.x,my.x) < 10) { my.move = 0; } } wait(1); } }
here in triggers the error
but when I removed this part
if(vec_dist(Distance.x,my.x) < 10) { my.move = 0; }
the error disappeared.. when i click the entity, it plays the animation. But there's an error again in clicking the ground.. when i click the ground after I'd click the entity... the game doesn't respond..
what is the meaning of this?
if(vec_dist(Distance.x,my.x) < 10) { my.move = 0; }
|
|
|
|