[SOLVED] black not being considered in sprites?

0 favourites
  • 6 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • 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

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

    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.

  • 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.

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)