How do I make this 4-way movement work?

Get help using Construct 2

Post » Thu Oct 09, 2014 7:26 pm

So i have a problem creating a 4-way top down movement. My player (black box) gets stuck on the edges and also cant move along the wall on all 4 sides. How do i make this work also. When you press the direction player has to move in that direction until it hits the wall, you also cant change direction mid movement, only when he hits the wall.

Project:
movement 4-way.capx
You do not have the required permissions to view the files attached to this post.
B
9
S
2
Posts: 18
Reputation: 569

Post » Thu Oct 09, 2014 9:10 pm

Try instead of making your own movement events using the 8-way movement behavior and setting its properties to 4-way movement (up,down,right,left) and put the keyboard control events inside a group (Movement). Then give your wall a solid behavior so it stops the player. Start layout with "Movement" group active then deactivate group "Movement" upon a movement key being pressed and only activate the group on a detected collision/overlap with a wall.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
68
S
17
G
8
Posts: 637
Reputation: 9,420

Post » Fri Oct 10, 2014 8:37 am

Yea that would work but still dosen't fix the issue where if i'm next to a wall and want to move along side the wall i dosent move cause it check for collision. Thats the main issue i have and have no idea how to fix it.
B
9
S
2
Posts: 18
Reputation: 569

Post » Fri Oct 10, 2014 8:43 am

Hi, not sure if im missing something but would this work? - requires no code as such other than the built in behaviours.
You do not have the required permissions to view the files attached to this post.
B
11
S
2
G
1
Posts: 68
Reputation: 777

Post » Fri Oct 10, 2014 8:53 am

Nop this is not what i meant. I couldve done this on my own :=).

If this helps:

Lith - iOS Gameplay Review - type this in youtube (i cant post links to little rep :( )

I want to make that type of movement.
B
9
S
2
Posts: 18
Reputation: 569

Post » Fri Oct 10, 2014 9:01 am

Yeah I thought it seemed too simple :D

I see what you mean now, off the top of my head if the walls and player was both set to solids, and the player also had the 'bullet' behaviour on him (setting the bullets angle and speed based on the direction pressed) , then an event for when he hits a solid, set his speed to 0

To fix an issue where he might not move due to being right next to a wall, you could always add an event to check when his bullet speed is 0 (ie stopped) , move him more central in the tile / empty square hes in, only needs to be by a pixel or 2 so wouldnt be noticed.
B
11
S
2
G
1
Posts: 68
Reputation: 777

Post » Fri Oct 10, 2014 9:06 am

I understand what you mean. I will give this a try and i hope it will work. :D
B
9
S
2
Posts: 18
Reputation: 569

Post » Fri Oct 10, 2014 9:25 am

nice one :) , let me know if you need any help as when I have finished work should be able to put it together, but you will probably have it cracked by then :P
B
11
S
2
G
1
Posts: 68
Reputation: 777

Post » Fri Oct 10, 2014 4:31 pm

So i'm currently working on the solid and bullet beh. The thing i noticed is i cant make the player move up and down. Also how can i check from wich direction i hit the wall.

So if i hit it from right to make player.x - 1
if i hit from top make player.y - 1
etc...
B
9
S
2
Posts: 18
Reputation: 569

Post » Fri Oct 10, 2014 10:35 pm

OK, I got it working using some creative thinking.
Try this out and see if it doesn't feel like the video shows.
You do not have the required permissions to view the files attached to this post.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
68
S
17
G
8
Posts: 637
Reputation: 9,420

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 34 guests