DogeDev's Forum Posts

  • Side scrolling or top down? Either way, just add a random amount of angle to each bullet when created after you've set it's target.

    So for example something like:

    Bullet is created >

    Rotate 360 degrees to mouse.x, mouse.y

    Set angle self.angle + random(-5,5)

    Oh, i almost forgot, thanks for the code buddy! And, i have a question about your code, why is necessary the rotate 360 degrees?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's a question of mine, and, I was wondering if I could use it or not.

  • Side scrolling or top down? Either way, just add a random amount of angle to each bullet when created after you've set it's target.

    So for example something like:

    Bullet is created >

    Rotate 360 degrees to mouse.x, mouse.y

    Set angle self.angle + random(-5,5)

    It's possible to use Angle of motion in the bullet behavior? Because i used it but, didn't worked, The code i'm using is:

    On Left button pressed

    Every FireRate Seconds

    Pistol spawn Bullet on layer Bullets (image point: fire)

    Bullet set angle of motion: round(random(-10,10))

    But, somehow, it didn't work.

  • Hey DogeDev, leaderboards are not implemented in the new arcade yet. See this post:

    https://www.construct.net/en/forum/scirra-website/website-issues-and-feedback-35/new-arcade-private-beta-145764

    Oh, didn't knowed that, really thanks buddy!

  • Ay bois, this is jut an simple question, that, is how to make an decent spread in Pistols/UZIS/Rifles and more. It's an 2d game and, i want an simple and good spread to use in weapons, somehow i tried 4 codes and they didn't worked, and, i'm lazy to think more or just make an spread with duct tape & glue. So, if you know, please tell me!

  • You mean gradually? Try lerp:

    Bar set width to lerp(self.width, 500*(Player.health/100), dt*2)

    Thanks, it worked!

  • Bar set width to 500*(Player.health/100)

    Hey bro, do you know how to drain the health bar when the player got hit? Like in the video?

  • Bar set width to 500*(Player.health/100)

    Lmao didn't thinked that simple math, but, thanks anyway.

  • Ay bois, so, in my game, i want an health bar, that i can make in every width ( not only, set the width to player's health ), like the width being 500 but, the health of the player just being 100, and, the width scalling with the 100 HP. If you know how to make a health bar like i said, or, the health bar of the video below, please, tell me!

    Video: youtube.com/watch ( He's at the right time )

  • If every enemy should have a pistol, add them to a container. Then the code will be very simple:

    On every tick - Pistol set position to Enemy.imagePointX("gun"),Enemy.imagePointY("gun")

    You won't need "For each" loop, won't need to link them by UID.

    Thanks a lot bro! It work!

  • > On Enemy destroyed
    Repeat 10 times
    	Create Cube at (Enemy.x+random(-50,50), Enemy.y+random(-50,50))
    	Cube disable physics collision with Cube
    	Cube set scale to random(0.5, 1.5)
    	Cube apply impulse random(1,2) at angle random(200,340)
    	Cube set angular velocity to random(-300,300)
    	... etc.
    

    Of course, you will need to experiment with all these values and Physics settings (density, damping etc.)

    And, sorry for asking again bro, but, you're so helpful for me in all my threads, so, you can see my new problem that i posted in the forum? I really don't know how to fix it.

  • > On Enemy destroyed
    Repeat 10 times
    	Create Cube at (Enemy.x+random(-50,50), Enemy.y+random(-50,50))
    	Cube disable physics collision with Cube
    	Cube set scale to random(0.5, 1.5)
    	Cube apply impulse random(1,2) at angle random(200,340)
    	Cube set angular velocity to random(-300,300)
    	... etc.
    

    Of course, you will need to experiment with all these values and Physics settings (density, damping etc.)

    Thanks man, and yes, i just mess with everything changing all values to see what happens while i'm having some fun xd and to know if is it good or not.

  • My own version of what? What have you tried?

    If you want to try Physics - create a number of cubes in a loop, for each cube set random scale, apply random impulse at random angle, random torque or angular velocity.

    Your version of the code, an exemple of the effect in the video for me, just to see the method you'll use.

  • Ay bois, in my game, you need to shoot some cubes to get money and some other things. The problem here is, when one enemy spawn, he will spawn with an pistol, and, the code that i made works perfectly with the position of it. BUT, when another enemy spawns, his pistol will glitch, and, lock in the place where he just spawned. So, if i have more than 1 enemy spawned, the pistol of the 2 enemy and above will glitch and lock, i tried using UID, but, didn't worked, i tried using iid, and, worked perfectly, BUT, when you kill one cube, everything screws off, i tried using my own created ID, but, like the UID, it glitches anyway. I tried using everything that i thinked, but, i don't know if is an wrong position of the code( lol what a coicidence in event sheet too. ), or the code is wrong, i'm using for each but, it seems to not work too. Please, if you know how to fix it, tell me!

    Code: imgur.com/a/psf4B6h

    Error: imgur.com/a/qmjLe8N

  • Try Physics. Disable cubes collisions with other cubes, they should only collide with the immovable ground.

    Or you can use Bullet behavior with gravity and Bounce off solids=yes. On Collision with the ground reduce bullet speed. It will not look that nice, but should have better performance.

    Oh, k, thanks, but, sorry for asking more again, but, you could make your own version? Like, everything i made is not that 70%, so, your code should be better in perfomance than me, or just in another way, for me to see will be better, and thanks again for helping me!