Page 1 of 1
2 actors with key down event problem
Posted:
Sat Jul 08, 2006 2:16 pm
by Hyperyon
Both actors have a keydown event so they can move together.
I gave one actor a collision event with an object. Whenever it collides, it stayes behind while the other actor proceeds moving. How can I keep them together?
Posted:
Sat Jul 08, 2006 7:31 pm
by makslane
Why you don't parent the actors?
Posted:
Sat Jul 08, 2006 11:16 pm
by Fuzzy
instead of moving the actors together with key down events, do that with one actor, and on the draw event set the other actors x and y based on the keydown event actor.
Posted:
Sun Jul 09, 2006 2:19 pm
by Hyperyon
I parented them
However, my main goal is to keep them together even when one collides with something. I cant figure it out and worse, I cant continue my game untill I learn how
Posted:
Mon Jul 10, 2006 10:47 pm
by Game A Gogo
put a cilision on the two
Posted:
Tue Jul 11, 2006 1:50 am
by DilloDude
What do you want to happen when one collides? Do you want them both to stop?
Posted:
Tue Jul 11, 2006 7:42 am
by Hyperyon
What do you want to happen when one collides? Do you want them both to stop?
Yes sir!
Make another Character Follow a Character Code Shown Here:
Posted:
Thu Jul 13, 2006 3:45 am
by shadowburn
Check this or try it at your leisure:
Depending on the size of your graphic character, in this example its 32x32:
Keydown Event = Down
{
y = y + 6; //speed of travel
newactor.y = aminactor.y -32;
newactor.x = aminactor.x;
}
Keydown Event = Up
{
y = y - 6; //speed of travel
newactor.y = aminactor.y +32;
newactor.x = aminactor.x;
}
Keydown Event = Right
{
x = x +6; //speed of travel
newactor.x = aminactor.x - 32;
newactor.y = aminactor.y;
}
Keydown Event = Left
{
x = x -6; //speed of travel
newactor.x = aminactor.x + 32;
newactor.y = aminactor.y;
}
//Cheers, -Jon
Posted:
Thu Jul 13, 2006 1:21 pm
by Hyperyon
I dont understand what that code will do, all I need is something to stop an actor. I tought of something; when the collide actor collides, i'll disable my main actor's keydown events keeping him absent from movement. However, I need him to move anyplace but past the collision.
Guess i'll also use keydown events for the collide actor so when it moves away from the collision I can enable my main characters keydown events again. I hope it works...
Posted:
Fri Jul 14, 2006 3:17 pm
by Hyperyon
I got what I wanted! Thanks all! I couldnt have nailed it without you!