Mouse events in RTS games

Non-platform specific questions.

Mouse events in RTS games

Postby Tytan McAnguns-PL » Thu Jul 12, 2007 8:41 am

It is used such system in strategic games that when it will be pressed on actor and on field next, it moves in this direction .
I have it problem. Anybody knows as make when it will be clicked on actor goes it on field to this part next but?
But when it will not be clicked on actor, will not be moved it in this direction .
Project: Ninja Fighter (full) for tekdino
Shadow mask warrior (full) 100 % IIIIIIIIIII download :
http://www.esnips.com/doc/ff4b58fa-600b ... sk-warrior
POLISH FORUM GE:
http://www.ge.4.pl
User avatar
Tytan McAnguns-PL
 
Posts: 67
Joined: Sat Mar 31, 2007 9:38 am
Location: POLAND
Score: 16 Give a positive score

Postby metal_pt » Thu Jul 12, 2007 9:37 am

Try this (4 clones only):

Create a global integer variable named for instance "selected".
The default value should be -1.

On the player actor use this:
on mouse click left
Code: Select all
selected=cloneindex;


Create a "filled region" actor that extends for all the world. (z depth lower than player actors and higher than everything else)
on mouse click left

Code: Select all
char plname[255];
if(selected>-1)
{
    sprintf(plname,"playeractorname.%d",selected);
    MoveTo(getclone(plname), view.x+xmouse,view.y+ymouse, 2.000000, "Game Center", "");
}


Don't forget to restore the "selected" variable to -1.

Hope it works!
]v[eta[_ - Using GE since June, 15 2007
Currently using v1.3.8 Registered
metal_pt
 
Posts: 117
Joined: Sat Jun 16, 2007 12:57 pm
Location: Sintra, Portugal
Score: 2 Give a positive score

Postby Tytan McAnguns-PL » Thu Jul 12, 2007 11:29 am

Warning line :
Image
Project: Ninja Fighter (full) for tekdino
Shadow mask warrior (full) 100 % IIIIIIIIIII download :
http://www.esnips.com/doc/ff4b58fa-600b ... sk-warrior
POLISH FORUM GE:
http://www.ge.4.pl
User avatar
Tytan McAnguns-PL
 
Posts: 67
Joined: Sat Mar 31, 2007 9:38 am
Location: POLAND
Score: 16 Give a positive score

Postby metal_pt » Thu Jul 12, 2007 12:19 pm

oops...
try it this way

Code: Select all
MoveTo(plname, view.x+xmouse,view.y+ymouse, 2.000000, "Game Center", "");
]v[eta[_ - Using GE since June, 15 2007
Currently using v1.3.8 Registered
metal_pt
 
Posts: 117
Joined: Sat Jun 16, 2007 12:57 pm
Location: Sintra, Portugal
Score: 2 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest