Physics Related Issue - help needed
mcbain220
Member Posts: 1
Hi all,
I'm new to GS and relatively new to any level of programming as well, so please bare with me.
I'm trying to work out a concept, and I can't quite get there. I've tried a bunch of things, and could use some guidance. My game has three actors:
Hero: the goal is to set a path (using waypoints) for the hero to get him from a starting position to an end goal.
Enemy: Right now, i'm just trying to have the enemy chase the hero.
Friend: This guy is going to follow a set path, which the hero can use to block the enemy's path (by setting the path in such a way to block the enemy's path with the friend).
I've experimented with move-to, accelerate toward, and interpolate for all the movement. People on here seem to love interpolate, but unless i'm missing something, I dont think it will work for my needs. I need all actors to move at a constant speed from the start, but since the path of the Hero is user defined, I cant predict the distance between individual waypoints, so I'm not sure how to set a constant speed. I've ended up using move-to to get all the actors moving the way I want them to, and that has worked great so far.
The problem I'm having is with the physics. I've set the actors to collide with each other, and I started experimenting with density, friction, and bounciness. For right now, all actors have the same settings. I've set gravity for the scene to zero. I would expect the Enemy and Friend actors to run into each other and stop (if on a direct path, which is what i'm testing), but for whatever reason, the Enemy actor is defying physics and ends up pushing the other actors of the screen. This issue seems to be how the enemy actor is set to move to the point that the hero is currently occupying. If I remove this and have the enemy follow a set path, the physics works as I expect.
Is this a bug, or is there something I should be doing differently? Any thoughts or links to possible solutions would be greatly appreciated!
I'm new to GS and relatively new to any level of programming as well, so please bare with me.
I'm trying to work out a concept, and I can't quite get there. I've tried a bunch of things, and could use some guidance. My game has three actors:
Hero: the goal is to set a path (using waypoints) for the hero to get him from a starting position to an end goal.
Enemy: Right now, i'm just trying to have the enemy chase the hero.
Friend: This guy is going to follow a set path, which the hero can use to block the enemy's path (by setting the path in such a way to block the enemy's path with the friend).
I've experimented with move-to, accelerate toward, and interpolate for all the movement. People on here seem to love interpolate, but unless i'm missing something, I dont think it will work for my needs. I need all actors to move at a constant speed from the start, but since the path of the Hero is user defined, I cant predict the distance between individual waypoints, so I'm not sure how to set a constant speed. I've ended up using move-to to get all the actors moving the way I want them to, and that has worked great so far.
The problem I'm having is with the physics. I've set the actors to collide with each other, and I started experimenting with density, friction, and bounciness. For right now, all actors have the same settings. I've set gravity for the scene to zero. I would expect the Enemy and Friend actors to run into each other and stop (if on a direct path, which is what i'm testing), but for whatever reason, the Enemy actor is defying physics and ends up pushing the other actors of the screen. This issue seems to be how the enemy actor is set to move to the point that the hero is currently occupying. If I remove this and have the enemy follow a set path, the physics works as I expect.
Is this a bug, or is there something I should be doing differently? Any thoughts or links to possible solutions would be greatly appreciated!
Comments
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Yeah, I've experimented with the density quite a bit. That doesn't seem to be the issue. It seems to completely ignore the physics once I set the Enemy's path to be specifically where the Hero is.
Just to be clear, I'm using the Move to function, and telling the Enemy within the scene to move to Hero.position.X and Hero.position.Y (through Scene.background). This is where it ignores the physics. If I set it to Hero.position.X and Y=400 (or something like that), physics works as expected.
I've even tried an indirect link, by having the Hero set to Game X & Y attributes, and having the enemy use those instead. Same problem.
In any case, I'm trying to work around it, but was just wondering if anyone had encountered anything similar.