How do I do this kind of game.

Get help using Construct 2

Post » Sun Jul 27, 2014 10:36 pm

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.
B
3
Posts: 2
Reputation: 179

Post » Sun Jul 27, 2014 10:49 pm

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.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Mon Jul 28, 2014 9:10 am

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?
B
18
S
4
Posts: 87
Reputation: 1,199

Post » Mon Jul 28, 2014 9:33 am

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.
B
18
S
4
Posts: 87
Reputation: 1,199

Post » Mon Jul 28, 2014 4:52 pm

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.
B
3
Posts: 2
Reputation: 179


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, Google [Bot] and 11 guests