How to test collision 1 time only

Hi Everyone,

I'm making one of those car slide games where you are trying to get all the cars out of the parking lot.

I'm struggling with how to have car_1 stop moving forward when it hits another car_1 but then can be tapped again to move again the other direction even though it is still touching car_1.

So I want car_1 to stop moving on collision, but not to keep testing for collision if it isn't moving (I'm using the Move function).

Thanks in advance.

Comments

  • uptimistikuptimistik Key Master, Member, Sous Chef, PRO Posts: 255

    Hi @computerking9979 I did a quick test project for you demonstrating how it can be done.

    Two self attributes:

    (Boolean) MoveMe

    (Integer) WhichDirection

    When the car collides with the walls, the WhichDirection attribute changes its value (so if it's 1, it will turn to 0) and I have a rule that states if WhichDirection is 1, then go left, if its 0 then go right. The MoveMe attribute is turned On by the player tapping the car and turned off by the player hitting a wall.


    I hope this helps and would love to see how the game turns out!


    GameSalad Templates and Custom Development at the Official Marketplace: http://gshelper.com

  • ArmellineArmelline Member, PRO Posts: 5,334
    edited August 2023

    I made a parking game for one of the puzzles in Sand. Before adding it to Sand I made it as a separate project to figure things out. I can't promise this works fully as I haven't looked at it in a couple of years but it should give a pretty good starting point. I only did 2x1 blocks in the test project but added 3x1 blocks with no issues when I slotted it into the main game.

    It uses tables to limit how far actors can move, removing the need to deal with overlaps and collisions at all.


  • computerking9979computerking9979 Member Posts: 11

    Thanks, how do import those into the web version of GS? I don't see an import or load option.

  • uptimistikuptimistik Key Master, Member, Sous Chef, PRO Posts: 255
  • computerking9979computerking9979 Member Posts: 11

    Ya, I can see those.

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,065

    @computerking9979 To import a project into Creator 2, do the following:

    1) Publish the project. You can go to https://publish.gamesalad.com and drag the zip file into "New Game" at the bottom. Follow the steps.

    2) Go back to creator, click on Project, Published Projects.

    3) Hover over your new project. Click on the cloud with the down arrow on the left side of the screen. That will import the project into Creator 2.

Sign In or Register to comment.