[SOLVED] black not being considered in sprites?

Discussion and feedback on Construct 2

Post » Wed Sep 17, 2014 11:11 am

Hi guys,

I have found that black is considered transparent in sprites. How do you change it to something else? As this is causing issues in my game.

1. On sprite animations that shrink something. The black space gets bigger yet is not considered in the touch calculations. Work around is to change the collision area on all the animation frames.
2. I added a pure black sprite. So when you place it it in the layout it doesn't show anything at all.

Kind regards
Wyrm
Last edited by TheWyrm on Wed Sep 17, 2014 3:36 pm, edited 1 time in total.
ImageImageImageImageImage
B
19
S
5
G
1
Posts: 614
Reputation: 2,542

Post » Wed Sep 17, 2014 11:27 am

I just fixed point 2. It was partly my own fault and partly this black thing. When you create an all black sprite you will need to override the size it automatically sets to the actually sprite size. Then you just need to place it in the correct layer ;)

However, I still want to know how to change the colour so I can set it to something more obvious like pink instead. So if anybody knows put in a reply.
ImageImageImageImageImage
B
19
S
5
G
1
Posts: 614
Reputation: 2,542

Post » Wed Sep 17, 2014 11:40 am

Afaik, black is not considered transparent in C2 without using blend modes or other things.

EDIT: I might have misunderstood, if you want to have transparent instead of black, just change the image.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Wed Sep 17, 2014 2:25 pm

@Aphrodite I'm not really talking about transparency. It seems it's more C2 making an assumption that black should not be considered as part of the collision area of the sprite for touch events.

For point 1 mentioned above lets say I have the following sprite animation.

Image

The collision area of each frame is automatically set to the planet by C2 for each frame. So it gets smaller the further along it is in the animation. This means if I tell it play once when the mouse is over it and to reset when not. Then only just touch the side of the planet, the collision area gets smaller and so the mouse is no longer in it. So it will keep animating and resetting in a loop. Whereas if I manually change the collision area to every frame so it takes up the whole sprite it solves the problem. However, this is a pain if you are using lots of animations with black backgrounds. So I would like to really turn it off, rather than assuming black is not wanted in the collision area.
ImageImageImageImageImage
B
19
S
5
G
1
Posts: 614
Reputation: 2,542

Post » Wed Sep 17, 2014 2:39 pm

I just made a black sprite with a white circle in the middle. Importing this into C2 generated a collision polygon that was the maximum size of the sprite (square). It did not ignore the black border. Maybe post a CAPX or your graphic.
ImageImageImage
B
71
S
22
G
247
Posts: 3,753
Reputation: 137,552

Post » Wed Sep 17, 2014 2:56 pm

@blackhornet Ah ok, after trying to recreate the problem I discovered where I went wrong. At first I uploaded a version of the sprites with a transparent background. I later updated it with a black background. The collision area was remembered from the first attempt. My own fault. Thanks guys.
ImageImageImageImageImage
B
19
S
5
G
1
Posts: 614
Reputation: 2,542


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 3 guests