Bullet problem

0 favourites
  • 13 posts
From the Asset Store
This pack contains 10 types of bullet effects, with different shapes and colors.
  • I want an object bullet behavior X to stop at a distance.

    But this does not stop.

    On start of layout->Sprite.Bullet.Angle = 0

                                     Sprite.Bullet.Speed = 100

    Sprite.X = Self.X+100->Sprite.Bullet.Speed = 0

    But it does not work...


  • There is a build in action to bullet behaviour called "compare distance travelled" or something like that, which will trigger whenever the bullet have travelled a certain distance. Have you tried that?

    Also In your example you use self.x, doesn't that keep changing the original X position of the bullet, didn't you mean to test if the bullet have travelled 100 pixel from its starting position?

  • I had problems with it too, I solved this with

    every tick->bullet.x>1500->set bullet X to 1500

  • bullet distance travelled works, if over a certain amount set speed bullet to 0

  • nimos100:

    Yes, I tried the expression "bullet distance travelled" did not work.

    Yes, exactly want that when the bullet has traveled eg 100 pixels, this stops.

    trollface:Your code does not help. I want every x pixels the scroll projectile, this stops.

    vtrix:This action does not work.

    <img src="smileys/smiley19.gif" border="0" align="middle" />

  • Your condition is wrong, since its really difficult to make sure that your sprite (Bullet) hits and exact integer factor. The chance that it will hit exactly 100 is very slim. You can just change the "Bullet distance travelled" to "Bullet distance travelled >= 100" and then it works.

  • nimos100:Yes and no, because I'm looking for that since the new position can move every 250 pixels. <img src="smileys/smiley1.gif" border="0" align="middle" />

  • The idea is to make a screen selection menu lively.

    The selection menu would be like this game:

    Subscribe to Construct videos now
  • Hmm then I think you might be better off just using an "every tick" with a Set sprite.x = sprite.x + 2 or whatever will hit the exact conditions you need.

    Or you can add a check that will set the sprite to the correct position you need after it reach it.

    So if "Bullet distance travelled >= 100" -> Set sprite.x = 100. And if you need to make it more dynamic, just store the sprite.x start position, and calculate what the new condition should be, based on that. So if its every 100 pixel.

    You can compare the starting condition to the sprite current position and divide it by 100 and multiply that with 100.

    So instead of sprite.x = 100, you make it:

    sprite.x = Round((Starting_position + sprite.X)/100) * 100

    However depending on which way the sprite is travelling you need to change the + to - I think, to make it work.

    So if its travelling left it needs to be:

    starting_position - sprite.x

    And if its travelling right it needs to be:

    starting_position + sprite.x

    At least I think it will work. But math aint exactly my strongest point to be honest, so it might be wrong as I haven't tested it. :D But you can probably see if it works if you do it that way.

  • ok! I will test and if it works share the capx. <img src="smileys/smiley17.gif" border="0" align="middle" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It does not work. I think I did something wrong. In the end the solution I found is to create an object in that position and when the camera collide with this, the camera stops.

    Simple and effective! <img src="smileys/smiley1.gif" border="0" align="middle" />

  • What ever works <img src="smileys/smiley4.gif" border="0" align="middle" />

  • <img src="smileys/smiley20.gif" border="0" align="middle" />

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