Bullet hits a tile (Random action and no action)

0 favourites
  • 3 posts
From the Asset Store
Each tile 64 by 64 pixels - Ultimate Tile Set for your awesome games
  • This is the case #1:

    1) Bullet hits a tile >> Action

    2) Bullet hits a tile 2nd time >> No Action

    3) Bullet hits a tile 3rd time >> No action

    .....

    8-12) Bullet hits a tile ( choose randomly lets say between 8th and 12th time) >> Go to 1)

    What do we use in this case, what you think?

    The case #2:

    Bullet hits a tile >> Check

    Check1 >> True

    Else >> Choose randomly between X actions ( Action 1, Action 2, Action X, No action)

    Check2 >> True

    Else >> Choose randomly between X actions ( Action 1, Action 2, Action X, No action)

    Check 3...

    Here, I use Local number Which = 0 .

    If I need to make something happen more frequently , lets say I increase the chance that TurretBodyAbove will be created, I do the following

    If I need to reduce the chances of actions within the roll , I do the following

    Is it correct? Are there better ways to do that?

  • I'm not too sure if I perfectly understand, but are you asking for methods on how to achieve what you mention? If yes, this is what I usually do.

    For case1, I would use a local variable. For example, after hitting the tile for the first time, check to see if the tile's local variable is 1. If it is, do your actions and set the tile's local variable from 1 to 0. So the next time it hits it, it won't run anymore. If you want it to run for the 1st and maybe the 5th or other number, use a sub event and put the conditions if local variable = 1 "or" 5.

    Case two, I usually do this as well. But if you want something to happen more frequently, instead of making 4 events for it, you could do it with just 2. Again just use the "or" event. Which = 1 "or" Which = 2 "or" Which = 3. For the last one, you could do that but if you are going to leave it empty, than there is no need to create the event there. If you have an event running that will reset it or your are not going to run that event again, you can just keep the two events and remove the rest.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you want to increase the chance turretbodyabove would be created you could just use:

    Choose(1,1,1,2,3)

    I would actually recommend using a function call with the choose as one of the parameters..

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