lots of collision boxes and overlays!

For questions about using Classic.

Post » Wed Sep 24, 2008 10:55 am

I'm messing around with bullets, lots of bullets!

I know that customisable bounding boxes aren't featured yet, which would instantly solve my problem, but, at present whats the best way to shoot a very large amount of box bullets with an object attached to it, so I get my graphics looking right with a correctly sized bounding box attached to it?

also, because i'm spawning both a graphic and a collision box, and doubling the graphics per bullet I guess this will hammer the framerate?

thanks as always, construct is turning into a total weapon!!
B
4
S
2
G
5
Posts: 149
Reputation: 2,025

Post » Wed Sep 24, 2008 11:27 am

I don't really understand what you mean by this:

[quote="work3":2w7jpbuw]whats the best way to shoot a very large amount of box bullets with an object attached to it, so I get my graphics looking right with a correctly sized bounding box attached to it?[/quote:2w7jpbuw]

But I'm guessing you want to make little collision detectors around an oddly-shaped object? Why don't you just use Per Pixel collision? Or if your object is too detailed, make a separate less detailed sprite that's roughly the same shape and use that as it's Per Pixel collision.

And if that doesn't help you out, maybe try explaining what you're doing a little better.

And you shouldn't really see any big difference in framerate until you have a couple thousand things on the screen, unless they have effects applied to them, or they're like physics objects or whatever.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Wed Sep 24, 2008 2:25 pm

my apologies for not explaining so well

I'd like to make the collision area of my bullets smaller than the actual area that the bullets really are.

but I was unsure of the best way to create a new bullet object on each collision box.
B
4
S
2
G
5
Posts: 149
Reputation: 2,025

Post » Wed Sep 24, 2008 3:46 pm

You could try just setting the bullet's collision type to 'Point'. This means they only register a collision if their hot spot is overlapping something else.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Wed Sep 24, 2008 3:56 pm

tried that before, but its a bit TOO small.. :/

*edit*

stupid question deleted.
B
4
S
2
G
5
Posts: 149
Reputation: 2,025

Post » Wed Sep 24, 2008 9:20 pm

A very simple solution that doesn't use any detectors at all:

http://www.fileshack.us/get_file.php?id ... hitbox.cap

The "bullet" (in this case, the big blue square) has two animations, one that is it's "display" animation which gets drawn to the screen, and the other which is it's "hitbox" animation that does the collision. The hitbox animation is smaller than the display animation (32x32).

Before doing any collision checks with the player, set the animation of the bullet to "collision." After checking collision events, set it back to "display" so that Construct will draw the correct sprite. Construct only draws the screen after all the events have run, so you will never see the bullet showing it's collision box animation.

In this example you can see that even though the player (brown box) can walk onto the "bullet," he doesn't get knocked away unless he touches the center of it.

This should do exactly what you need it to do, and in fact would be a good way to do custom detectors in general without using separate objects.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Wed Sep 24, 2008 10:40 pm

Perhaps an addition can be made as well to the point collision system to include image points added to the Sprite.

Then no additional animations would be needed to expand the point slightly.
B
2
S
2
G
5
Posts: 391
Reputation: 2,432

Post » Wed Sep 24, 2008 11:34 pm

[quote="Jeswen":1mwlxpc5]Perhaps an addition can be made as well to the point collision system to include image points added to the Sprite.

Then no additional animations would be needed to expand the point slightly.[/quote:1mwlxpc5]

You can already do this.

[code:1mwlxpc5]
+System: Sprite collides with point at Sprite2.ImagePointX("colliderpoint1"), Sprite2.ImagePointY("colliderpoint1")

+System: Sprite collides with point at Sprite2.ImagePointX("colliderpoint2"), Sprite2.ImagePointY("colliderpoint2")

etc, etc, repeat for all image points
[/code:1mwlxpc5]

But I hardly think that's easier than my way.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Wed Sep 24, 2008 11:44 pm

No I know you can do it, I meant an addition to the internal workings thus not needing any events at all. Just a checkbox.

But no, it's not a huge difference in efficiency, I just like to point out possibilities.
B
2
S
2
G
5
Posts: 391
Reputation: 2,432

Post » Thu Sep 25, 2008 6:11 am

thanks deadeye, thats an exellent way of solving the problem!

*gets back to work*
B
4
S
2
G
5
Posts: 149
Reputation: 2,025

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 8 guests