Collision and Movement Question

Hi, I just started learning Gamesalad two days ago and I'm already making my first game, woot! But I'm very new to game making so sorry if these questions are very noobish:

1. I'm making a tetris like game where objects randomly spawn from the top of the screen, fall to the bottom and stack. If they stack to the top, the game is over. I'm having a hard time figuring out how to make the game recognize the top collision. Since the objects are being generated from the top, if I put in a top wall, the objects hit the wall as soon as they spawn and the game is over. I feel like there's a piece of logic I'm missing.

2. I want to make the objects fall like snow flakes, they would be in a constant downward motion but swing slightly from left to right as they fall, so far, my efforts have been things shooting off the screen.

Thanks in advance for your help!

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited December 2012
    Here's a very quick snow flake motion:
    (I don't quite know what your game is doing so I made it fairly generic - but you might be able to extract something from it).

    http://www.mediafire.com/?pjh503k6ineeaga
  • SocksSocks London, UK.Member Posts: 12,822
    edited December 2012
    Question 1:

    Maybe when your actor falls downwards passed the collision line - have a line below that which switches on it's sensitivity to the higher collision line*.

    So it needs to pass the lower line line before it's primed to detect the upper collision line.


    * Use a boolean attribute, something like 'have I passed the collision line yet ?' being switched on by passing the collision line.
  • tolicattolicat Member Posts: 6
    Thx Socks, the snowflake looks awesome! I tried your solution for the collision line and I couldn't get it to work. The object that is falling is 40 pixels high, it starts out 40 pixels above the top of the viewing area. I created a lower collision line at 40 pixels below the top and a higher collision line at the very top. But if the object has been turned on by the lower collision line, it will never hit the top collision line since other objects are stacking on top of it. And if an object can hit the top collision line (with enough objects underneath it), it would never hit the lower collision line to switch it on.

    But the switch was a good idea so I used a timed switch instead and it works well.

    Thanks again!
  • SocksSocks London, UK.Member Posts: 12,822
    . . . if an object can hit the top collision line (with enough objects underneath it), it would never hit the lower collision line to switch it on. . . .
    Good point ! : )
  • sniffy176sniffy176 Member, PRO Posts: 48
    @tolicat

    I'm not sure how you are making your blocks move, but if they are using acceleration, then one solution might be:

    Set up a Game attribute called 'moving' set to true

    In the block itself create a rule if self.motion.linearVelocityY = 0 change attribute 'moving' to false. (so when the block stops moving it changes the game attribute.)

    Then set it so when the block collides with the top bar AND isn't moving.. then it's game over.

    That might work?
Sign In or Register to comment.