Using the third type of collision shape (the Shreddies lesson)

JackBQuickJackBQuick Member Posts: 524
edited November -1 in Working with GS (Mac)
Edit: Sorry, this post doesn't really introduce anything new. I was playing with an idea and let it get away from me. I wish I could delete this. However, if you want to see me embarrass myself, read on...

A third type of collision shape? There's only two, you might be thinking to yourself: square and circle.

However, what if you took a square and turned it 45 degrees? It becomes a diamond.

Big deal. So what?

There is one important use of a diamond: if you have square blocks set in a grid, it allows the blocks above and below it, and the blocks to its left and right to self-identify. Here's a demo:

Diamond Collision Shape (Demo)

Behind the green button is a pink diamond. When you press the button, the blue blocks that overlap the pink diamond display an 'X'.

Again, so what?

It seems to me that if you take the technique of the Block (Demo) and add it to the Diamond Collision Shape (Demo), you are on your way to making a SameGame-type app.

In other words, if a blue block overlaps a pink diamond -- you might want to make the pink diamond invisible -- have a new diamond spawn on top of it. Theoretically, you can identify all the adjacent blocks of the same color using this technique. (Use a global attribute to collect the color of the pressed block and compare overlapping blocks to this global attribute.)

I'm not interested in making a SameGame-type app but if you are please feel free to run with this. However, I am interested in knowing whether this works (or not) so please post your findings.

Cheers!

Edit: Okay, I feel sort of dumb: you can do the same thing with a square collider (rather than a diamond shaped one). Where the diamond one comes in handy is when the actors don't touch each other. Even then, you can use an oversized square. Okay, I'm going to bed now. It's obvious that I need sleep...

Comments

  • chosenonestudioschosenonestudios Member Posts: 1,714
    Wonder what would happen if you turned a circle 45 degrees..... Damn it, I thought I was on to something......

    Anyway Great Find!
  • JackBQuickJackBQuick Member Posts: 524
    Okay, I feel sort of dumb: you can do the same thing with a square collider (rather than a diamond shaped one). Where the diamond one comes in handy is when the actors don't touch each other. Even then, you can use an oversized square. Okay, I'm going to bed now. It's obvious that I need sleep...
  • ORBZORBZ Member Posts: 1,304
    I think you have a valid point for doing cross testing of collision
    if you have a 3x3 matrix and you want to know if all positions hit by a + are valid then you can use a diamond. if you want to know if all 3x3 positions are hit then you can use an oversized square.
  • JackBQuickJackBQuick Member Posts: 524
    Thanks, ORBZ! I still feel silly though.

    The reason I was thinking about this was I vaguely recall somebody in these forums wondering how a SameGame-type of game could be made (although he called it something else). I still think that it's possible to make it using the methods I described. However, I have so little free time that I need to prioritize my projects otherwise I'll get nothing done. That's why I offered it to the GameSalad community. However, if nobody is interested, I'll put it on the backburner and take it out again in a couple of months.

    Thanks to everybody for their patience :)
  • ORBZORBZ Member Posts: 1,304
    What is a SameGame-type of game?
  • design219design219 Member Posts: 2,273
    ORBZ said:
    What is a SameGame-type of game?

    I was wondering the same thing. I guess he did go to bed (makes me wonder what time zone)... We'll have to wait a while for the answer.
  • JackBQuickJackBQuick Member Posts: 524
    Here's a definition from Wikipedia:

    http://en.wikipedia.org/wiki/SameGame

    I've seen this game around in various forms but didn't know what to call it so that everybody would know what it is.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    CodeMonkey has a version of SameGame on his wall that uses collisions...

    SameGame is a classic puzzle game where you click on groups of adjacent blocks of the same color - thus removing that group from the grid. The rest of the blocks collapse in.

    GameHouse made a version of it called "Collapse!".

    And PopCap has a version of it called Big Money!.
  • JackBQuickJackBQuick Member Posts: 524
    CodeMonkey's version is here:

    http://gamesalad.com/game/play/24461

    @design219 - Yes, I was sleeping. I was taking an afternoon nap :) I'm in the Eastern Time Zone.
  • ORBZORBZ Member Posts: 1,304
    ahh...

    thanks.

    additionally, you got me thinking. you could have static triangle colliders by overlapping a square with the top half of a diamond, editing the bottom half of the diamond in photoshop to be transparent, turning the visibility off of the rectangle, and putting the two objects together into a tag called "triangle" it wouldn't work if they were moving around, but it would work for stationary objects.

    note: moving objects would be possible, although tricky, you would have to have each scene instance coded to track it's rectangle/diamond counterpart and adjust it's x,y coordinate offsets accordingly as it moved. this would only be possible with scene actors and be very fragile.

    But for stationary objects it's much easier since they don't move.

    Objects would then test if they hit both objects (via the tag) and only then would they collide with the diamond. but since the square only overlaps the top half, they would pass through the bottom half of the diamond (which should be invisible due to the graphic you made in photoshop)

    rule looks like this:

    when overlaps with tag triangle
    collide with actor diamond

    tricky, but possible.

    a better solution is to wait until gamesalad supports arbitrary polys. *cough* *cough*
  • JackBQuickJackBQuick Member Posts: 524
    @ ORBZ - It was very cool the way you figured out the triangle colliders. This opens up the possibilities a bit. For example, overlapping a square/diamond with a circle, you could have pizza slice shaped colliders! (I know it sounds funny but I'm actually quite serious.)
Sign In or Register to comment.