How do I movement

Get help using Construct 2

Post » Sun May 24, 2015 6:21 am

how to make he can't go thro solid object i whan he move 32 pixel when press Image
B
2
Posts: 7
Reputation: 162

Post » Sun May 24, 2015 8:53 am

I'd recommend using the built-in behaviours inside of Construct 2 for this, but, if you want to do it this way you could add subevents to those events, so, for example:

The player presses the up arrow key move the player 32 pixels up, check if it is overlaping the wall object and if it is move the player 32 pixels down.

Here's a .capx:

Collision

I also altered the collision box to be a little smaller. It mustn't touch the edges of the sprite.
Banned User
B
6
S
3
Posts: 105
Reputation: 1,170

Post » Sun May 24, 2015 11:25 am

That will only work if the character and walls are at least 30 pixels wide though @tarik00555. With a 2 pixel wall and a 10x10 pixel character it could skip right through. So you would have to considder the placement of every piece.. Here is your example but sizes are changed so it doesn't work anymore. https://dl.dropboxusercontent.com/u/1750576/gothroughwalls.capx

So this is really up to @vorpalblade if it would work in his situation or not. Perhaps otherwise show as an example of what you mean vorpal..


Is there nothing like raytracing in construct? Anyone?

Otherwise perhaps use lerp and have an invisible object move from the character to the destination and report any overlay with solid objects which would cancel the move.
Not sure if this could be made practical and work but I know this would work in theory. Someone with proper Construct2 knowledge here that can give their thoughts on what I just suggested?
B
54
S
7
G
8
Posts: 150
Reputation: 5,817


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 9 guests