HELP: How to make an object to follow mouse with distance :?

Talk about making games.

Re: HELP: How to make an object to follow mouse with distanc

Postby bat78 » Sat Jul 21, 2012 7:58 pm

Hblade that can be made with moveto too (: awesome.
(without speedup)
HBlade.ged
(1.05 KiB) Downloaded 27 times


what about my code that make the actor like a gum if mouse make circles around him :D
y=ymouse/6;
x=xmouse/6;

gum.ged
(1.08 KiB) Downloaded 27 times
Future of "Project Game-Editor Revival" here
User avatar
bat78
 
Posts: 378
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 30 Give a positive score

Re: HELP: How to make an object to follow mouse with distanc

Postby Hblade » Sat Jul 21, 2012 9:24 pm

bat:
moveto causes the actor to shake ^-^ replace moveto with my code and see what i mean. also, no matter how far the actor is, he always arives at his destination within the same ammount of frames :) creates for quite the awesome effect if I do say so myself.
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4370
Joined: Fri Dec 08, 2006 11:14 pm
Score: 169 Give a positive score

Re: HELP: How to make an object to follow mouse with distanc

Postby bat78 » Sun Jul 22, 2012 12:39 am

of course..i saw the different :)
what about the "gum" ?
Future of "Project Game-Editor Revival" here
User avatar
bat78
 
Posts: 378
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 30 Give a positive score

Re: HELP: How to make an object to follow mouse with distanc

Postby Hblade » Sun Jul 22, 2012 6:32 am

ill try the gum one tomorrow -w- sounds cool
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4370
Joined: Fri Dec 08, 2006 11:14 pm
Score: 169 Give a positive score

Re: HELP: How to make an object to follow mouse with distanc

Postby bat78 » Sun Jul 22, 2012 12:32 pm

mhm useful for some kind of games. =]
Future of "Project Game-Editor Revival" here
User avatar
bat78
 
Posts: 378
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 30 Give a positive score

Re: HELP: How to make an object to follow mouse with distanc

Postby Hblade » Mon Jul 23, 2012 1:45 am

neat ^-^
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4370
Joined: Fri Dec 08, 2006 11:14 pm
Score: 169 Give a positive score

Re: HELP: How to make an object to follow mouse with distanc

Postby bat78 » Mon Jul 23, 2012 5:37 pm

Hblad can i ask u sth ..
I was wondering for something that i need to put in my game.

U know the key-down drag function. I want the actor to stop move when they are in collide. Do u know how to ?
Future of "Project Game-Editor Revival" here
User avatar
bat78
 
Posts: 378
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 30 Give a positive score

Re: HELP: How to make an object to follow mouse with distanc

Postby Hblade » Mon Jul 23, 2012 5:49 pm

make a variable called drag

mouse down:
Code: Select all
drag=1;


mouse up
Code: Select all
drag=0;


Draw Actor:
Code: Select all
switch(drag)
{
    case 1:
    angle=direction(xscreen, yscreen, xmouse, ymouse);
    directional_velocity=distance(xscreen, yscreen, xmouse, ymouse);
    break;
    case 0:
    directional_velocity=0;
    break;
}


Then add a physical response collision

that should do it :)
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4370
Joined: Fri Dec 08, 2006 11:14 pm
Score: 169 Give a positive score

Re: HELP: How to make an object to follow mouse with distanc

Postby bat78 » Mon Jul 23, 2012 6:28 pm

O_O
Oh well...
I'll try it right now !
What kind of hardest script that i ever seen ;x
But yes..i understand the script :D

Edit:
That doesent work but maybe that will take work?

player-->Collation to floor canvas--> *variable=1
player-->Collation Finish to floor canvas--> *variable=0;

[floor canvas]
Draw actor-->Script Editor:
if (*variable==1) {
EventDisable("Event Actor", EVENTMOUSEBUTTONDOWN);
}

[player]
Actor-->Collation to floor canvas:
y=y+1;
(that will make the actor free for drag after the event disable from the floor canvas)

in pawn C++ system u can define the positions >.<
#define meh, cel, rix, ren
Last edited by bat78 on Mon Jul 23, 2012 6:49 pm, edited 1 time in total.
Future of "Project Game-Editor Revival" here
User avatar
bat78
 
Posts: 378
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 30 Give a positive score

Re: HELP: How to make an object to follow mouse with distanc

Postby bat78 » Mon Jul 23, 2012 6:32 pm

Oh that stop my actor's gravity.
And the drag need to stop when the actor is in collide to canvas ;/
Possible?

Ok i use that: player-->Draw Actor
Code: Select all
yvelocity = yvelocity + .5;
if (yvelocity>15) {
    yvelocity = yvelocity = 15;
                  }

(collation physical response to canvas floor)

Mouse button down
Drag
Code: Select all
;


that is my simple gravity mechanism
Future of "Project Game-Editor Revival" here
User avatar
bat78
 
Posts: 378
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 30 Give a positive score

Re: HELP: How to make an object to follow mouse with distanc

Postby bat78 » Mon Jul 23, 2012 7:04 pm

And also can be unprofessional made by moveto:
no_exit.ged
(1.39 KiB) Downloaded 22 times


And with sliding effect:
no_exit2.ged
(1.4 KiB) Downloaded 26 times
Future of "Project Game-Editor Revival" here
User avatar
bat78
 
Posts: 378
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 30 Give a positive score

Re: HELP: How to make an object to follow mouse with distanc

Postby Hblade » Mon Jul 23, 2012 9:25 pm

lol in the mouse up you just have a random ; symbol xD
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4370
Joined: Fri Dec 08, 2006 11:14 pm
Score: 169 Give a positive score

Re: HELP: How to make an object to follow mouse with distanc

Postby bat78 » Tue Jul 24, 2012 1:41 am

i dont use mouse up D:
:D What r u thinking about that event ?
can u present ur code :?
("as i know u can't use variables on directional_velocity if u dont use angle on directional_velocity not used for velocity in pixs")

Edit:
no sense of "directional_velocity=angle=12;"
that cause the actor to move in 12o and 12 velocity. i realy can't find the code :cry:
Future of "Project Game-Editor Revival" here
User avatar
bat78
 
Posts: 378
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 30 Give a positive score

Re: HELP: How to make an object to follow mouse with distanc

Postby Hblade » Tue Jul 24, 2012 4:20 pm

im confused xD
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4370
Joined: Fri Dec 08, 2006 11:14 pm
Score: 169 Give a positive score

Re: HELP: How to make an object to follow mouse with distanc

Postby bat78 » Tue Jul 24, 2012 9:37 pm

Cause i am the big "pro" ?? :P
Present me code that will allow drag actor when they is in collation. The actor have velocity for gravity.
U can still drag the actor in collation but not more cause the actor will continue velocitying :D
Sth that my code that i present with moveto but the actor need to be in the current possition when they is in collide and drag of. they need to back in the current possition ;p
Future of "Project Game-Editor Revival" here
User avatar
bat78
 
Posts: 378
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 30 Give a positive score

PreviousNext

Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest