Achieve this specific movement?

Get help using Construct 2

Post » Mon Apr 16, 2012 1:49 am

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.Kyre2012-04-16 04:07:03
B
2
Posts: 8
Reputation: 341

Post » Mon Apr 16, 2012 3:57 am

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?
B
2
Posts: 8
Reputation: 341

Post » Mon Apr 16, 2012 2:52 pm

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.
B
2
Posts: 8
Reputation: 341

Post » Mon Apr 16, 2012 3:07 pm

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?
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Mon Apr 16, 2012 3:39 pm

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).

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

Thanks again.
B
2
Posts: 8
Reputation: 341

Post » Mon Apr 16, 2012 3:49 pm

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.
ImageImageImageImageImageImage
B
93
S
19
G
12
Posts: 1,192
Reputation: 18,301

Post » Mon Apr 16, 2012 4:04 pm

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

Example: EnemySlimeLerp.capx
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Mon Apr 16, 2012 4:05 pm

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.
B
2
Posts: 8
Reputation: 341

Post » Mon Apr 16, 2012 4:07 pm

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.Kyre2012-04-16 16:11:03
B
2
Posts: 8
Reputation: 341

Post » Mon Apr 16, 2012 4:11 pm

Ah, sorry. I'm using the latest beta version.
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Next

Return to How do I....?

Who is online

Users browsing this forum: makotto, randomly, Walessio and 24 guests