Super Basic Collision Question

For questions about using Classic.

Post » Sat Oct 17, 2009 11:23 pm

[quote="Farmrush":38fdk3y0]Say I have A BOX moving along the X AXIS and it COLLIDES with another BOX so I want it to stop moving.[/quote:38fdk3y0]

You never actually stated which method you are using to move your sprite. And I still don't really get the problem tbh. :P
If your using a movement behavior, you would just set the speed to 0 on collision or when overlapping.

On collision between Sprite A and Sprite B
> Sprite A Set speed to 0

Of course if your sprites are instances of the same object and picking is your problem, you'll need to add 2 different families to the object and check for collision between family A and family B instead.

If it's still not what you're actually asking I suggest you throw in a cap. :?
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Sat Oct 17, 2009 11:29 pm

B
2
G
3
Posts: 68
Reputation: 986

Post » Sat Oct 17, 2009 11:52 pm

Okay is this supposed to become a physics game/tryout or something? Since the player has physics behavior, but you set its position with events. You don't want to do that if that's the case. Add force/velocity with events and stuff. And other things it collides with need to have physics behavior as well.

Or is it just accidently in there and you absolutely want to move your sprite with events? Sprite.X + Value*TimeDelta Style?
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Sun Oct 18, 2009 12:02 am

That was just me dicking around, assume the position should be set.
B
2
G
3
Posts: 68
Reputation: 986

Post » Sun Oct 18, 2009 12:17 am

You could do something like this. I'm still new with Construct, so don't mind the mess, and I'm sure there's plenty more ways to achieve this.. But this is what I came up with...

http://theone.lithfaq.com/timedelta.zip
B
3
G
3
Posts: 42
Reputation: 959

Post » Sun Oct 18, 2009 12:22 am

That's one way I thought of, but it's not very eloquent and then you have the spasms when it's running into a wall.
B
2
G
3
Posts: 68
Reputation: 986

Post » Sun Oct 18, 2009 12:24 am

You could use 4 "sprites" that are updated to the sides of the box every tick. When one overlaps the box, whichever direction is hitting you cant go.
B
3
G
3
Posts: 42
Reputation: 959

Post » Sun Oct 18, 2009 12:29 am

So is there no way to just check if "Sprite.X + (200*TimeDelta) is collision-free"?
B
2
G
3
Posts: 68
Reputation: 986

Post » Sun Oct 18, 2009 12:37 am

This may be what you're looking for, hopefully:
[url:at3udt84]http://upload.namelezz.net/downloader.php?file=3828287_perfectstop_002.cap[/url:at3udt84]
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Sun Oct 18, 2009 12:46 am

I have never heard of .Left and .Right, what are they exactly?
B
2
G
3
Posts: 68
Reputation: 986

PreviousNext

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 8 guests