Push sprite with other sprite as if it has no mass

Get help using Construct 2

Post » Mon Jan 25, 2016 6:24 pm

I have two sprites, one is the character with 8 directional movement. The other sprite is a simple block.

When the character hits the block I want him to push it.

I don't want the character to slow down at all when hitting the block (I tried physics with block set to 0 mass and it would still slow the character down).

I don't want the block to continue moving after the character stops (I tried physics and the block would continue to slide a little).

I would also like to limit the block to move only one direction at a time between left, right, up, or down. This would ideal but not necessary.

Any help on how I would be able to accomplish this?

Thank you in advance.
B
2
Posts: 8
Reputation: 166

Post » Mon Jan 25, 2016 6:50 pm

Nothing goes unanswered!
B
24
S
5
G
1
Posts: 434
Reputation: 3,446

Post » Thu Jan 28, 2016 1:07 am

I've tried this and it works as expected until I turn the acceleration up of the green colored "Sprite" to "600."

I hit the red colored "Sprite 2" and basically pass right through it.

Any suggestion for instant feedback no matter the speed?
B
2
Posts: 8
Reputation: 166

Post » Thu Jan 28, 2016 8:49 pm

Here's an improvement:

while
sprite: is overlapping sprite2
--- sprite2: move 1 pixels at angle Sprite.8Direction.MovingAngle


You can still run into the issue of sprite passing through sprite2 if it's speed is so high that one frame sprite is on one side of sprite2 and the rest it's on the other without colliding. But this is usually not an issue and the solution is to check the inbetween positions for collisions.
B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » Fri Jan 29, 2016 12:53 am

Yeah, I didn't see much change with that. As I'm pushing Sprite2 with Sprite as the speed increases Sprite simply pushes through Sprite 2 and leaves it sitting in its tracks.
B
2
Posts: 8
Reputation: 166

Post » Fri Jan 29, 2016 3:36 am

Did you include the while condition?
If you did and it still leaves it behind how fast is Sprite going?
B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » Sat Jan 30, 2016 5:43 pm

Maybe I'm doing it wrong.

I added it without the System:While and once I add that the game fails to launch.

I'm adding it after everything else in the event sheet as follows:

Line #5
System:While
Line #6
(Indented underneath Line # 5) Sprite:Is overlapping Sprite 2:Sprite 2: Sprite.8Direction.MovingAngle
B
2
Posts: 8
Reputation: 166

Post » Sat Jan 30, 2016 5:43 pm

Sprite has a max speed of 600.
B
2
Posts: 8
Reputation: 166

Post » Sat Jan 30, 2016 6:16 pm

Guesswork is not helping anyone. This is why it is always best to provide a .capx so we can see what you've done and provide a much quicker and hopefully positive response.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
134
S
30
G
84
Posts: 5,375
Reputation: 58,432

Post » Sat Jan 30, 2016 6:20 pm

maxaud wrote:Maybe I'm doing it wrong.

I added it without the System:While and once I add that the game fails to launch.

I'm adding it after everything else in the event sheet as follows:

Line #5
System:While
Line #6
(Indented underneath Line # 5) Sprite:Is overlapping Sprite 2:Sprite 2: Sprite.8Direction.MovingAngle


"Sprite:Is overlapping Sprite 2" should be another condition to event 5 instead of a subevent..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Next

Return to How do I....?

Who is online

Users browsing this forum: plinkie and 21 guests