Having some difficulties with movement
ColorplayGames
PRO Posts: 69
Hello!
I'm currently working on a game where the default movement of the actor is to drift slowly down (it's a jellyfish!) To accomplish this I have different rules for moving right and left and under "Otherwise" for each I have a "Move" behavior that makes the actor drift down. So far, so good.
Now what I'm trying to do is add another actor into the game that causes the jellyfish to zoom upwards a little bit when they collide. I can get the zoom to happen by saying that when the jellyfish collides with the zoom object, for .25 seconds (run to completion) Move 90 degrees at a Speed of 500. I have the same default drift down behavior in the "Otherwise" section, but the jellyfish for some reason won't drift down after hitting the zoom object. (It will resume drifting if I move it right or left again.)
I've tried a bunch of different combinations of behaviors but can't seem to get this to behave the way I'm hoping. Any thoughts?
Thanks so much for your help,
Jenna
I'm currently working on a game where the default movement of the actor is to drift slowly down (it's a jellyfish!) To accomplish this I have different rules for moving right and left and under "Otherwise" for each I have a "Move" behavior that makes the actor drift down. So far, so good.
Now what I'm trying to do is add another actor into the game that causes the jellyfish to zoom upwards a little bit when they collide. I can get the zoom to happen by saying that when the jellyfish collides with the zoom object, for .25 seconds (run to completion) Move 90 degrees at a Speed of 500. I have the same default drift down behavior in the "Otherwise" section, but the jellyfish for some reason won't drift down after hitting the zoom object. (It will resume drifting if I move it right or left again.)
I've tried a bunch of different combinations of behaviors but can't seem to get this to behave the way I'm hoping. Any thoughts?
Thanks so much for your help,
Jenna
Comments
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
Here's what I do to mimic move in a way the does not cancel out gravity or jumping (zooming up in your case)
when right key is pressed AND
self.linear.X is < 250
accelerate 0 degrees to scene with speed 2000
when left key is pressed AND
self.linear.X > -250
accelerate 180 to scene with speed 2000
This will feel like using move with a speed of 250, but will work with falling and zooming up.
The only other thing I would play with is drag. When you move right and release the right button the jellyfish will have momentum and drag will effect this.
In your example, why do you require the linear velocity to be < 250 or > - 250? Is this to keep it within a maximum speed?
I think I've narrowed the problem down to the timer I'm using. When I have "run to completion" checked, the movement works correctly but the drift down action doesn't kick back in. When I don't have "run to completion" checked the player just bounces up and down over the Zoom object - the zoom only happens when the player is colliding with the zoom object, then the drift kicks in, then it collides again, etc. I've been using the timer because I want the player to collide with the zoom object, then zoom up regardless of whether it's still touching the object.. is there a better way to do this? Sorry for all the newbie questions, I'm still learning my way around this program
-Jenna
Rule
When collides with zoom object
change game.zoom to true (1)
Rule
when game.zoom is true
timer for 2 seconds (or whatever)
Accelerate 90
after 2 seconds
change attribute game.zoom to false(0)