SimoneT's Forum Posts

  • Armouredank

    Hi,

    Add a bullet effect to your turret. Make sure that the Set angle property is No and default speed is 0.

    On Turret shoot=> Set Turret's bullet speed to x, set Turret bullet angle of motion to (Projectile.Bullet.AngleOfMotion+180)%360, Wait x secs. and set Turret bullet speed to 0

    Experiment with bullet speed and wait time to achieve desired effet.

    Hope this helps

  • skdf

    Do you want the Enemy to stop forever, or just pause, and get back to moving? Do you want it keep going but to bounce off at an angle like a billards ball?

    (In my examples I have a TiledBackground called Wall)

    Stop forever:

    Enemy: On collision with Wall=> Enemy: Set bullet disabled

    Stop and pause:

    Enemy: On collision with Wall=> Enemy: Set bullet speed to 0

    Bounce off:

    No events needed, just make sure the Wall has Solid behavior and the Enemy has its Bullet behavior setting to Bounce of solids set to yes.

    Hope this helps, if not, give me more details on what you want to accomplish!

  • skdf

    It is also important to note if you are using a "Every x seconds" condition, the event won't be triggered until x seconds have passed. If the bullet speed is set at 400 by default and your sprite flies off the layout before the x seconds have passed and subsequent actions are implemented, it might seem like its not working. Try adjusting the default speed in the properties window to the left to the desired speed, or to 0.

    That done, if it still does not work:

    Every 2.0 seconds=>

    (sub-event)For Each Enemy=> set bullet speed to ...(40?), set bullet angle of motion to random(360), Wait 1.0 sec, set bullet speed to 0

    That should do it!

  • skdf

    Hi,

    Are you sure you are setting the bullet speed, and not the animation speed for your sprite?

  • Domse65

    I used oosyrag 's approach to solving the problem, but applied it to a 2d array:

    https://www.dropbox.com/s/5orwwxtwyrvdm ... .capx?dl=0

  • Domse65

    Got it!

    This might not be the best way, but it's the best I have at this moment:

    Create a second Array(Array2) to store the X location on your original Array where the value 1 might be found.

    Then set value at Array2.At(floor(random(0, Array2.Width))) to 2.

    Here is a capx to help:

    https://www.dropbox.com/s/8x9qi6acmomaj ... .capx?dl=0

  • joeb12

    Do you have a capx to share, because it should work fine on its own.

  • joeb12

    Did you make sure to set yes to loop in your animation properties window of the sprite on the left side of the screen?

  • Domse65

    To be clear, your array has only 2 values? If so, an easy way is to use choose():

    set at value at choose(0,1) to 2

    Or you have several values of 0 and 1 and you only want to choose a random 1 value and turn it into 2?

  • Programmer25

    The BoundToLayout behavior should cover what you are trying to accomplish.

    If for some reason, you want to stop the ScrollTo behavior, you can create an invisible sprite that, when PlayerBox is overlapping it, disables ScollTo, and Else enables it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • rah8011

    Welcome to Construct2! I highly recommend looking up the video tutorials to get you started!

    https://www.scirra.com/tutorials/top/pa ... e=detailed

  • rah8011

    Did you go in the projects window on the right, right click on the layout folder and click on "add layout"?

  • BillAlex

    Nope, my bad!

    I skimmed your capx too quickly. I misread tilemap.PositionToTileX/Y as set position of tilemap...

    Ninjadoodle

    My way works if you are using sprites objects, and BillAlex's way works for tilemap objects.

  • Hi Ninjadoodle

    BillAlex 's way to do it works great.

    But, if you only want to change the tile's frame, not position, you can do this:

    Add 4 global variables: SwapNumber1, SwapNumber2, TileName1, TileName2.

    When you select a tile (sub event: if counter is 0) => Set SwapNumber1 to tile's UID, set TileName1 to tile's name, add 1 to counter

    (sub event: if counter is 1) => Set SwapNumber2 to tile's UID, set TileName2 to tile's name.

    (sub sub event: select tile by UID (SwapNumber1)=> set Self.Name to TileName2, set animation frame to Self.Name

    sub sub event: select tile by UID (SwapNumber2)=> set Self.Name to TileName1, set animation frame to Self.Name, set counter to 0.

    Hope this helps.