Feature Req: Trimming and Collision Polygons

Discussion and feedback on Construct 2

Post » Fri Oct 11, 2013 6:31 pm

Hello There,

I wanted to request what is hopefully a small thing though of course that usually means it's a big change :)

I import a lot of sprite sheets into C2 for tile sets. I then go about trimming them all which gives me the 1px margin on each side. This is fine until I have to go and manually adjust the collision polygons on each one. Could you guys look into snapping the collision polygon to the visible pixels? Or giving an option to not have them auto expand to the trimmed area when you apply the trim to your animation frames? I have to go to each frame and manually adjust the collision corners back to the edges of the actual tile.

It would also be great if I have multiple animations that use the same basic shapes in them, if I could copy the collision frames from an animation and paste it into another one. As the above scenario with the trimming happens across all my animations and most of them are just recolored versions of eachother using blocks with the same shape in each frame.

Thanks,

BluePhaze
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,583

Post » Fri Oct 11, 2013 6:41 pm

With the collision displayed in the sprite editor, you can right click and apply it across the whole animation or all animations.
B
14
S
6
G
1
Posts: 143
Reputation: 1,795

Post » Sat Oct 12, 2013 10:56 pm

Look at it like this, you have created a tile strip with 44 tiles in it. You import it, then trim it, then have to manualy go into each tile to set the collision polygon to match only the visible pixels of the sprite not the trimmed transparent pixels added on all side.

Then in your graphic tool of choice, you create different color variations of that same tile strip. You import the various colored versions of the tile strip. You then have to go through each one manually adjust the collision polygons on each frame (44 frames for each tile set) multiply that by about 10 sets of tiles and you can see that it gets pretty tedious...

So being able to either A. Have it stick the collision rectangle to the visible pixels as an option, or B. be able to copy the collision polygons from one animation to another (especially if they have a 1 to 1 match up of collision polygons between the frames. For example if visible pixels in frame 1 of SPrite A match the shape of the visible pixels of frame 1 of Sprite B's animation then copy the collision polygon between them.

Thanks...
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,583

Post » Sat Oct 12, 2013 11:35 pm

"generate collision from alpha channel" button would really rock in the editor. An always on for import feature would rock too!

Nice suggestion.
B
29
S
8
G
4
Posts: 767
Reputation: 5,985

Post » Sun Oct 13, 2013 12:55 am

[QUOTE=BluePhaze] Look at it like this, you have created a tile strip with 44 tiles in it. You import it, then trim it, then have to manualy go into each tile to set the collision polygon to match only the visible pixels of the sprite not the trimmed transparent pixels added on all side.

Then in your graphic tool of choice, you create different color variations of that same tile strip. You import the various colored versions of the tile strip. You then have to go through each one manually adjust the collision polygons on each frame (44 frames for each tile set) multiply that by about 10 sets of tiles and you can see that it gets pretty tedious...

So being able to either A. Have it stick the collision rectangle to the visible pixels as an option, or B. be able to copy the collision polygons from one animation to another (especially if they have a 1 to 1 match up of collision polygons between the frames. For example if visible pixels in frame 1 of SPrite A match the shape of the visible pixels of frame 1 of Sprite B's animation then copy the collision polygon between them.

Thanks...[/QUOTE]

Unless I'm completely not understanding what you're writing here, you can already do this. Import all your sprites, as many animations as you want, then go into any frame on any animation and modify the collision. Then right click and apply to all animations. This will copy the collision shape to all frames of all animations.
B
14
S
6
G
1
Posts: 143
Reputation: 1,795

Post » Sun Oct 13, 2013 4:51 am

each of the 44 frames of animation has a different shape in it. So I don't want the same polygon in every frame of the same animation. I want frame ones collision polygon to be copied to frame one another animation, frame 2's polygon to be copied to frame 2 of another animation, etc... etc.... each frame has a different shape it in, but each animation is made up of the same series of shapes. For example frames 1-4 may be triangle, square, circle, octagon. Having the triangle collision polygon copied to all frames does not help me at all. But if I have another animation that has a difference colored triangle, square, circle, octagon, then copying the collision polygons from each of those frames in animation one to animation two makes sense. The triangle is in frame 1 so the triangle collision polygon get's copied to frame 1 of each animation, the square is in frame 2 so the squares collision polygon gets copied to frame 2 of each animation, etc... etc... see what I mean?
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,583

Post » Sun Oct 13, 2013 12:14 pm

If you have a folder based project, you can overwrite the image files in the project folder directly without affecting the collision masks.
Scirra Founder
B
395
S
233
G
88
Posts: 24,376
Reputation: 193,842

Post » Mon Oct 14, 2013 1:34 am

Tell me more!?!?!? This sounds like an amazing thing @Ashley... all my graphics, etc... are stored infolders, but doe you mean a specific project type? Or just using folders? That would be great, Could I duplicate the animation, then just swap out the graphics in the copy?
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,583

Post » Mon Oct 14, 2013 2:03 am

[QUOTE=BluePhaze] Tell me more!?!?!? This sounds like an amazing thing @Ashley... all my graphics, etc... are stored infolders, but doe you mean a specific project type? Or just using folders? That would be great, Could I duplicate the animation, then just swap out the graphics in the copy? [/QUOTE]

He means if you are saving your project as a folder project instead of capx (in the file menu it's something like project), then you can go to wherever you are saving your construct game and see all the files. They're in the "animations" folder. So in C2, right click on the file/sprite you wante duplicated (not in the image editor, the actual sprite on a C2 layout or in the file browser) and select duplicate type. And I apologize for not being near C2 at the moment so my terminology may be off.

Then you can go into the animations folder (the one made by C2), go to that new duplicate, and copy-paste replace the frames you want to replace. C2 will read those new graphic files but it won't go through the import process so the collision polygon will remain. So you'll still have to set the polygon at least once, but for subsequent variations, it goes much faster.

Hopefully that all made sense.
B
103
S
38
G
19
Posts: 962
Reputation: 17,996

Post » Mon Oct 14, 2013 7:16 pm

Thanks @C-7 if this works it will save me much time when creating new levels/worlds... if I am currently saving as a project, wouldn't I be able to save as a folder the next time, then make the changes, then after that switch back to saving as a project?
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,583

Next

Return to Construct 2 General

Who is online

Users browsing this forum: Huemerson and 13 guests