How do I do this kind of game.

0 favourites
  • 5 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • I made a couple of games already. But this one is the first to make me in real troubles. I am not even sure how the final rules of the gameplay will be, but I can't mane anything work. Here is what I want to do :

    It's kind of connect four (http://en.wikipedia.org/wiki/Connect_Four), but when you connect four, the associated pieces are deleted and you keep on it until your table is full. And obviously there would be more than 2 colors. I am working with 5 colors right now. So I made a sprite with 5 frames to differenciate the colors.

    My basic proble is that I can't use that kind of code (for example) :

    If frame of objectx = frame of objectx,

    and objectx.X = objectx.X+40,

    and objectx.Y = objectx.Y

    Then delete objectx

    It's more complicated than this but what I mean is that, I can't tell the game when pieces of the same color are align. Cause the he can't differenciate the different instances of the same object.

    I have tried to work with arrays, but I'm not sure exactly how to do.

    I'm not asking for a complete example, I'm just asking for an hint.

    Also, for making things easier, I have make another object invisible following every tick the different pieces. I made it larger than the visible object so it get in collision with pieces on the side. But as a result, if there are 100 pieces on the screen, there are 100 other pieces to overlap them everythick. It makes it laggy on mobile phones. But I'm sure there is a better solution than working with invisible trigger object.

  • Maybe easier to have a different sprite for each colour, in a family, than to work with frames like that. And, that logic doesn't make sense... but I think I know what you're trying to say.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Maybe instead of those invisible images overlapping you can make lines as long as 4 squares that are fixed on the screen instead of following the sprites, and than when theres a blue sprite overlapping it, it adds 1 to the line instance number variable called blue and when it reaches 4 it destroys the sprites that are overlapping it. This way you will have a lot less invisible objects to make the logic work?

  • Actually you still get a LOT of objects so don't mind me but maybe if the lines are 1px thin the collision check will not overload the cpu so much.

  • thanks for the ideas. I really want to make it work with arrays, cause I think it's the best way to do this. I'am trying to implement a cartesian map with each cell a data like (x,y). Put for eache piece instants variable that link them to the array. And then put all the conditions through the array itself. But for now, for obscrue reasons, the arrays don't take all my pieces into account.

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