Sprite colision depending on color

This forum is currently in read-only mode.
  • Hello. Im have two sprite. One is shell from tank and second is tank. When shell sprite collide with tank sprite, then shell sprite is destroy. This is ok, but im need destroy shell sprite later, when is over specific color in tank sprite. Im make tank sim and im have color mask sprite, where every color have specific function. For example red is ammo, blue is armor, green is engine. It is possible make this in Construct? Thank you for answer.

    PS: Sorry, but my English is bad, im not from US/UK.

  • I'm not from US/UK either, but my English is not that bad. It pays off to practice it

    Anyway, instead of using colour masks, why not use private variables to identify tank parts?

    Like private variable named 'type', on collision check if it is "fuel", "armor", "ammo" etc.

    It might make things easier.

  • Anyway, instead of using colour masks, why not use private variables to identify tank parts?

    Like private variable named 'type', on collision check if it is "fuel", "armor", "ammo" etc.

    Thank you for reply.

    Ok, but how ? Im dont known what you mean.

    I don't want tons of sprites for each part of tank. Im want single sprite for single tank by reason that many sprites = low fps.

  • If I understand you right, you want to color pixels within tank sprite differently and use those colors for purposes of collision detection? For that have to check each pixel of the tank sprite, which uses more CPU than multiple sprites.

    Maybe someone can advise you better, though.

  • use those colors for purposes of collision detection?

    Yes

    For that have to check each pixel of the tank sprite, which uses more CPU than multiple sprites.

    Really?

    However, i must use many of sprites ... or any idea?

  • Just use many instances of the same sprite, with a private variable to differentiate part type. It won't slow things down. However, if you want instances of tanks with multiple hitboxes, then it will be more convenient to have many different sprites, so that you can just make the tank a single contained object (since you can only have 1 instance of a sprite per container).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just go with several different sprites. This will also make complex interactions easier in the long run.

    You could, for example, have several different collision masks or even images for each part. Run effects on them, spawn fire/particles from their exact location, etc.

  • Thank you for ideas.

    I want make much tanks, infantry, layered buildings, etc in one moment on layer. The game will be strategy with penetration value/destroyable parts.

    How many sprites manage Construct with good framerate on average computer? I don't know how realize this game with relative good fps.

  • Hundreds, thousands, hundreds of thousands, it all depends on the size of the sprite.

    Creating multiple instances of the same sprite, organized by private variable, and image points is your best option.

    sprite private variable = 1

    blank sprite set position to sprite at image point gas

  • Hundreds, thousands, hundreds of thousands, it all depends on the size of the sprite.

    No, I wouldn't go over 2000-3000 regular size sprites onscreen at any given time, (<128x128) if you want to maintain good frame rate on modern non gaming pcs. Even with a 4x4 sprite, fps will slow down displaying over 15000 of them (on my fairly modern pc (8300 GS)), and that's without any events processing on them. Construct cannot handle hundreds of thousands of sprites effectively. However, fps all depends on your game. Start using shaders and you'll see slowdown a lot faster than displaying a lot of sprites.

  • Well yeah a hundred thousand would be ridiculous, all at one time.

  • Ok, thanks all.

    I try use many sprites and then i see. When im make some progress, then im place here .cap file.

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