Issues with tap events

0 favourites
  • 8 posts
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • Hello! I'm building a game where players build a course with draggable blocks in order to guide a ball to the goal. It is kind of hard to explain, but easy to understand when you play the game.

    https://www.dropbox.com/s/m3r945n7tst0snc/Rolling_Ball_Prototype.capx?dl=0

    I want to limit the number of blocks the player can use on each level. At the beginning of each layout, I set a global variable called 'blocksAvailable' to a specific number, depending on the difficulty of the level. For instance, on level 1, I set the blocksAvailable variable to 5, so the player has 5 blocks to use.

    I subtract 1 from the blocksAvailable variable anytime a player drags and drops a block anywhere other than the UI block (at the bottom of the screen) or one of the red barrier blocks.

    Here is where the issue comes into play. If I accidentally tap one of the blocks I've already placed on the grid, it subtracts 1 from the blocksAvailable variable. Each block should only be able to subtract 1 from the blocksAvailable variable. I've tried to control this by using the "Trigger Once While True" system event, using a variable called "placedOnGrid", and a couple of other ways I can't recall right now. None of my attempts have solved the issue.

    Eventually, I want to add the ability to flip blocks along their X axis by double-tapping them. This won't be possible if I can figure out a way to resolve this issue. Any help that can be provided would be greatly appreciated.

    Please let me know if any additional information is needed.

  • Your file isn't importing correctly from C2, not sure what's up with it. You had the right idea with the variable, I would go with this. You would add a condition to the subtract 1 event for variable not true, and then when a block is drag dropped you set the variable to true on the block.

  • Weird, I'm not sure why the .capx isn't working. I'll try it again and also include a c3p file

    dropbox.com/s/m3r945n7tst0snc/Rolling_Ball_Prototype.capx

    dropbox.com/s/gb8p7shemsrmhp8/Rolling_Ball_Prototype.c3p

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello! I'm building a game where players build a course with draggable blocks in order to guide a ball to the goal. It is kind of hard to explain, but easy to understand when you play the game.

    https://www.dropbox.com/s/m3r945n7tst0snc/Rolling_Ball_Prototype.capx?dl=0

    I want to limit the number of blocks the player can use on each level. At the beginning of each layout, I set a global variable called 'blocksAvailable' to a specific number, depending on the difficulty of the level. For instance, on level 1, I set the blocksAvailable variable to 5, so the player has 5 blocks to use.

    I subtract 1 from the blocksAvailable variable anytime a player drags and drops a block anywhere other than the UI block (at the bottom of the screen) or one of the red barrier blocks.

    Here is where the issue comes into play. If I accidentally tap one of the blocks I've already placed on the grid, it subtracts 1 from the blocksAvailable variable. Each block should only be able to subtract 1 from the blocksAvailable variable. I've tried to control this by using the "Trigger Once While True" system event, using a variable called "placedOnGrid", and a couple of other ways I can't recall right now. None of my attempts have solved the issue.

    Eventually, I want to add the ability to flip blocks along their X axis by double-tapping them. This won't be possible if I can figure out a way to resolve this issue. Any help that can be provided would be greatly appreciated.

    Please let me know if any additional information is needed.

    The file above wasn't working, so here is the project in c3p format and capx format:

    dropbox.com/s/gb8p7shemsrmhp8/Rolling_Ball_Prototype.c3p

    dropbox.com/s/m3r945n7tst0snc/Rolling_Ball_Prototype.capx

  • Yep variable should work, I don't see one? You can even do it with one event, the Blocks family and a family instance variable.

  • Sorry, I removed it because I couldn't get it to work. I've tried creating a boolean variable for the Blocks family called placedOnGrid and creating an event that states

    Blocks -> On Drop | Set placedOnGrid -> True

    Then I create a sub-event that says

    Blocks -> if not placedOnGrid | Subtract 1 from Blocks Available

    When I go to test, blocks that are placed on the grid can still be tapped and it subtracts 1 from the blocksAvailable variable for each tap. I might be putting the sub-event in the wrong place though.

  • It's because you're picking a block then creating a new one so the conditions don't really relate. I don't know how your game works but if you can keep creating the same block but it should only subtract from the variable once then the simplest way is to subtract immediately when you tap a block and also set the variable on it so that when you create future ones the variable wouldn't be adjusted. If it must be on a drop then you're going to have to do something more complicated, setting a variable on the initial tapped block and then applying that to the one that is created so on drop you can check it.

  • Oh, I was not making the connection that those events weren't related. Thank you so much!

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