How do I Bullet Behavior

0 favourites
  • 5 posts
From the Asset Store
This pack contains 10 types of bullet effects, with different shapes and colors.
  • How I do I say when (whatever) is created go to the direction of the player.

    Im trying to spawn the same enemy on both sides of the enemy that converge on the player. I tried the angle(self.x,self.y,player.x,player.y) and I'm not getting the behavior i want. they end up slanting above the ground or something. Also I don't want the enemies too float off the ground I want them to stay on whatever ground I spawn them on (depending in on the level design of course). I just need them to know. Ok I was spawned, player is X direction, set bullet of motion to X direction. PLEASE HELP ME its such a simple problem that I don't know the answer too and its holding up my hold project.

  • You shouldn't use the bullet behavior for that. The bullet behavior just shoots an object in one direction. That's why it floats off the ground.

    You need to use the Pathfinding behavior. So you let the enemy find a path (If the player's position is changing then every tick) and then you let the enemy go along the path that it found. It should find the player like that

    I hope I could help!

  • Thanks Im going to give it a try

  • I found a solution to my problem and if anybody needs help with this here is what I did to fix my problem.

    The Problem: I wanted my enemies to go in the direction of player at all times. The problem with the bullet behavior is that if I set the angle of motion it effects all the of the spawned enemies of the same name. (if I spawn the samurai and set its angle of motion to 180, all the samurai went at the motion) This isn't converging on the enemy because they are spawn on both sides

    Solution: It seems so simple now. What I found out is that if you make an event that with the enemy class you want to target, and you select "is clockwise from" in the angle section. (Focus on making the enemy/sprite you want to go left cause by default the bullet behavior sends a sprite right)

    Depending on your game this part might be a little different but, when it asks for an angle input the MAIN CHARACTERS OF YOUR GAME X position. This part distinguishes what enemy you are talking about. (Which enemies are clockwise from player.x? ok them, now what do we do)

    lastly you have to make sure your only affecting the enemies on that side by adding a condition. the condition I used compare the X coordinates of the enemies and the player. With construct 2 the X coordinate increases from left to right, AND i want to target the enemies are the right of the player, SO if the enemies X is Greater than the player's X, THEN set the bullet motion angle to 180 degrees.

    * only bug i found with this approach is that the enemies that are coming at the enemy from the left, will double back when their X becomes greater than the players X, which kind of looks silly, but if I "Fix" it will yo-yo the other's back also so I'm leaving it and design around it. IF you guys think of a way to fix it then go ahead

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You could use the pathfinding behavior but I was scare to personally because I didnt know how much it would take from the performance of the game because i want to port this to mobile. So if you want to get this to work with the pathfinding behavior then go ahead

    #EnemiesConvergeOnPlayer #MakingPlayerFocialPointOfEnemies

    (I dont know how to tag this in the search for other people looking for a similar solution if you know please do so because this could help someone)

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