Bullet and player movement are linked.

0 favourites
  • 6 posts
From the Asset Store
Players follower. use it for anything which follows the player
  • Hi everyone.

    I’m brand new to construct and game making in general. And I have an issue with bullet movement linking with player movement that is driving me nuts.

    I spent four hours yesterday trying to get my player to move, animate and shoot in the right direction. I have found a way that works, but it’s certainly not the most elegant solution.

    I use 8 direction movement, and shoot in four different directions, but have an issue with the bullet changing direction after being spawned because my player changes direction.

    I came on here to post a long query about my issue, and was going through the event sheet to post all the relevant details, when I stumbled on the problem, but still can’t figure out the fix for it.

    The offending piece of script:-

    System - player.8direction.movingangle = xx - bullet -set angle of motion = xx

    That is recreated four times, one for each direction of motion.

    This event means my bullet always aligns to my player movement angle, and leaves me with bullets turning corners and doubling back on themselves whenever I move my player.

    So long explanation for a short question,

    how do I get my player and bullet to act independently after spawning, keeping the correct direction of initial movement?

    Thanks.

  • If you're shooting them from the player then the usual is to use 'bullet on created : set angle' that way it has an angle set as you shoot it and doesn't change.

  • Thanks!

    That’s Seems so simple, but I completely missed it in all my efforts. It makes me look like a fool -_- While I’m looking foolish, I might as well ask, what ‘angle‘ do I set the bullet to? Player angle? Animation angle? Degrees?

    However, my problem persists. Because I don’t think I’ve sorted anything right from the start.

    My event sheet looks like this:-

    On space - player spawnbullet

    System - player animation frame = x - set bullet angle to xx

    For each direction

    System - player. 8direction. Moving angle =x - set bullet angle to xx

    For each direction

    The above works well when taken separately.

    Animation frame works for idle, and moving angle works for in motion. But then because of my second set of events for shooting and moving, the bullet is always turning to face whichever way the player is moving, it overrides any “on create bullet- set angle” I put in.

    I’m sure I’m being a complete noob, so I think I’ll have to scrap the event sheet and try find a proper tutorial rather than try muddle my way through by myself. But in all my searching I struggled to find 4 direction shooting tutorials, it was all just ‘mirrored’ for Platformers.

    I’ll look harder though :)

  • Perhaps you should try going through the beginner's guide first.

    Then, if you are handling your own bullet, using the bullet behavior, you will likely want to:

    Bullet - Set angle of motion to Player.8direction.MovingAngle

    Possibly post your project, as it seems you are having different states, which already sounds a bit more "advanced" and would require us to check out what you did to provide an accurate answer.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have been through the beginners guide, the issue with that is I’m not using mouse as an input, and because it’s not a fully top down game, I can just rotate the player sprite. I’m not quite sure how to post my project, or screenshots of it either.

    However, both or the suggestions posted have helped. Along with an hour of trial and error before work this morning they have worked.

    Just in case anyone else has similar issues.

    My initial event sequence checked:-

    system- player.8direction.Movingangle, and set bullet angle accordingly.

    But that always moved any bullets already spawned, I ended up with 10-12 bullets turning corners whenever I changed direction with my player.

    But using:-

    on created- set angle of motion - player.8 direction etc.

    This worked perfectly for moving. But when I stopped and my player was idle, the angles all changed again.

    So my hour of trial and error stumbled on sub-events which I didn’t (and still don’t, really) fully understand or grasp.

    So now I have sub events, under the above ‘on created’ event which are:-

    player- instance variable= Animation name - set angle of motion - xx

    One for each idle facing direction is working well.

    I still have issues shooting while moving diagonally, but I can live with that for now :)

    For now, I shall go study sub-events in more detail.

    Thanks.

  • To post your project file: Save your C3 project to a cloud service, or to your pc and then upload it to a cloud service. Then share that file (disable editing so the original won't get overwritten) and copy the link that is created. In your forum comment you can just paste the link in the text field. Others can then open the project

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