0 Favourites

Achieve this specific movement?

  • Hello,

    I've put off posting for a few days now but I've run out of "How do I...?" topics to search and projects to deconstruct in the hopes of figuring out how to solve my enemy movement issue. Some have come very close, but nothing yet is a usable fit. Hopefully someone here can point me in the right direction or offer some suggestions.

    I'll try and explain the issue as clearly as possible (probably over complicating it in the process).

    My current project is a side view game (player enters from left, enemies from the right), however the characters and enemies have the ability to walk to their left & right (technically up & down) as well as actual left to right along the X, while using prospective background drawings to simulate depth on the Z.

    The issue I'm having is that I can't seem to get enemies to advance towards my characters position after spawning without their sprites rotating as they change angle towards the player. The Player doesn't have this issue whatsoever with 8 direction movement and "Set angle" set to: No. However I can't find a similar solution for enemies running at the player.

    I've tried bullet movement with Set angle off and 'set angle to (player.x, player.y), however the sprite still rotates or alters it's orientation as it adjusts to the players location (ideally I'd like their heads to stay at the top and feet on the ground, rather than angling horizontally or at odd angles).

    I've tried non-default control 8-direction movement and simulating control with no luck, I tinkered with car movement options with no luck as well. In fact the closest I've come was some variation of the "Asteroid" demo, if I recall correctly (minus the unwanted elasticity).

    I'm sure there's probably a very efficient way to handle this that I'm just not experienced enough yet to see, so if anyone could point me in the right direction (although I've searched every imaginable combination of 'Construct 2, enemy movement, AI movement, movement options' that I could think of), or offer some possible solutions I would greatly appreciate it.

    Hopefully I've clearly explained the specifics. Let me know if you need any more info.

    Thanks in advance.

    Edit: A few more quick questions.

    Is pin a possibility in terms of attaching items a player picks to indicate equipping the item? For example I'd set the image point of a main character to the sprites hand area, and the image point of an equippable sprite object on the handle of the object - imagining that if I set it so ' if player collides with object, object is pinned to the players image point', how ever it always seems to get pinned to a random area of the character? Is there a better way to accomplish this that I haven't considered (likely as I'm quite new)?

    Also, my main character is set for grid movement, however, when he reaches the top of the grid he's laid out to, and I press up, it senses he can't move up and instead always moves him forward. Is there a way to prevent that? He's set to move in 74 pixel increments up, down, left or right, if that's of any use.

  • I was thinking I might be getting close to a solution with bullet movement towards players angle, then playing with flipping and mirroring sprite if enemy sprites.X<player.X, but it only seems to ever half work.

    If I pass the enemy, going further to the right than him, he just carries on towards players initial position although he's supposed to set angle toward player every tick.

    Am I on the right track or (hopefully) have I overlooked some movement function that would neatly sort this issue out?

    There's no way such a simple movement scheme should be *this* tricky to get to function, I must be missing something?

  • Hmm, no thoughts yet? I assumed it wasn't a hard issue to solve and I was only having a problem with it because I'm fairly new.

    Is it not possible to have sprites move around the x&y planes and maintain their original orientation in construct 2 outside of platform movement? That can't be right.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • The players angle is pointing towards the enemies, right? So can't you just set your enemies angle to the opposite of the players angle? Moving them Up/Down/Left can then be done with custom movement or events.

    I might have misunderstood your problem, but I find it a bit hard to follow your post, maybe you could post a .capx?

  • Thanks for the reply, yeah as I said I'm sure it's a simple problem that I'd over complicate.

    How exactly do I set the enemy sprites angle to opposite the players? As the players angle wont change (always facing initial facing) would that still work.

    I'll upload a stripped down capx but it literally has only player movements and whatever the last enemy movement events I left in, as this is more of a testing scene for the main project. But it'll at least clearly explain what I'm talking about (the slime should move towards the players location without changing orientation, that's all).

    dl.dropbox.com/u/73716511/EnemyMoveTest.capx

    Thanks again.

  • How you didn't a screenshot, and I probably misunderstanding your questions, I'll try to talk about the hack and slash game style (Final Fighter, Excalibur, Battletoads, Ninja Turtles, etc).

    You will can figure it out easy, the main issue is handle the Z order of your canvas, where an enemy from behind of the scene will walk to the front and if an ambush is between this path, you'll have to handle it manually, one by one, each object of the canvas =(

    So, I don't want to teach you here how to reproduce the solution, but I already did on a old test.

    Think about a shadow, place it on the character bottom, so, make your character stand for the shadow, and handle the shadow to the 8 directions. Restrict the scenario for the shadow only stay in a certain area, and when the player or monster go up, resize it to smaller, giving the right aspect of going far. When the monster or player jump, make him jump relative to this shadow, so, the Z origin of all the other sprites will be the shadow Y.

    To make the monster face the player, just get the variable X and Y of the player (or his shadow), if the monster X is bigger than the X player, he is on the right, if his Y is bigger, so, he is behind the player.

  • Maybe you could use lerp to make the slime move towards the player?

    Example: EnemySlimeLerp.capx

  • Thanks Telles, but I'm not sure I quite follow yet. I'll try reading it again.

    I think it's my fault for explaining myself poorly originally. I'm simply trying to get the enemy sprite to remain at it's initial orientation as it moves towards the player from any direction. Everything I've tried results in sprite rotation as it alligns to its new angle (the angle its being told to move on toward the player).

    There's probably a simpler way of explaining this but after the past 3 days of wrestling with this my brain is fried. In construct 2 terms it's probably very simple to do, I just can't seem to figure out what that is.

  • Thanks Nim, but it's telling me I have version 84 and cant run a version 86 file. I'll go look into how to update, I'd assumed as I just downloaded a new copy a week ago it'd be up to date (unless it's a free vs paid thing?)

    I'll look into it :)

    Edit:Nm, DLing the newer version.

  • Ah, sorry. I'm using the latest beta version.

  • Yes, that's exactly it! Thank you so much Nimtrix. I don't think Lerp is something I would have likely figured out on my own so I really appreciate it.

    Thanks a bunch for the help all, that's exactly what I was after.

  • No problem, and to answer your other questions:

    Is pin a possibility in terms of attaching items a player picks to indicate equipping the item?

    You could try adding another image point to your character, and position the weapon sprite at the image point.

    Also, my main character is set for grid movement, however, when he reaches the top of the grid he's laid out to, and I press up, it senses he can't move up and instead always moves him forward.

    You can stop the "move up" event by adding another condition that checks the Y position of the player, like this:

    Updated Example: EnemySlimeLerp.capx

  • Again, thanks so much. I've learned so much from all of this and that is hugely satisfying. I really appreciate the help, I was hitting dead ends on my own.

    Edit: The Y solution there is much more elegant than my latest attempts. Taking parts of tutorials apart is a great way to learn, but seeing things applied to specifically what I was working on really helped the ideas behind these solutions to click. Although now I have to go investigate lerp and delta time a bit more in depth, but it's good to have a direction.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
233 22,268
TiAm's avatar
TiAm
Unread hot topic
0 Favourites
Path Movement Behavior
98 52,480
R0J0hound's avatar
R0J0hound
Unread hot topic
0 Favourites
achieve this lightning effect
30 4,976
zenox98's avatar
zenox98