Bullet directions!

  • So I have a top down 'bullet hell' game that I followed one of the tutorials here to build. Worked great at first until I added character selection (player animations) and corresponding bullet animations.

    The player is 4 directional but naturally only shoots bullets to the right. When I add something like:

    right arrow down : set bullet angle of motion to X angle

    left arrow down : set bullet angle of motion to X angle

    It changes the direction of the bullet correctly BUT if the player starts off shooting right and then turns left, all of the bullets just shot to the right will redirect and head left. It's actually kind of a cool effect - but not what I want in this game.

    Like I said, when the player was one animation the whole thing worked fine but something happened when I added animations that threw it off. Any ideas? I'll add some more info below that may be useful.

    Character selection (ctr) is a global variable. Player is set so if ctr = 0 then load a certain animation, etc. Each animation has 4 frames for each direction that correspond to arrow keys pressed. I've toyed around a lot with bullet behavior and 8-directional behavior with no avail. The bullet spawn point is set for each frame to load on the correct edge of the frame...idk, muh brain hurts.

  • if you add something like this?

    If I understood correctly

    Each animation has 4 frames for each direction ...

    your animation looks like

    so..if frame is 0..Bullet angle =0*90=0;...frame 1=1*90=90;...frame 2=2*90=180;...frame 3=3*90=270

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • korbaach - YES! Still took some tinkering but man... I never would've thought to do frame*90 to get the angle. Genius. Thank you so much!

    https://media4.giphy.com/media/VgNQdejHFZJdu/200.gif

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