How can i do properly bullet traectory

0 favourites
  • 9 posts
From the Asset Store
This pack contains 10 types of bullet effects, with different shapes and colors.
  • So I have a 8direction character and i need he to be able to shoot in a straight line from two points in the direction of the mouse

  • Use a helper sprite, that is a single point, probably located between the two active points. Get the angle from the helper point and set both the active points to the same angle.

    Or just use one to decide the angle and set the other to the same angle.

  • Get the angle from the helper point and set both the active points to the same angle.

    i still don't understand. How hepler sprite should change its angle depending on the cursor

  • Areitia - Apologies for the triple post. Here is another example that will work properly. I basically added another trajectory helper that rotates at the center of the Player Sprite in relation to the mouse.

    Then the bullet angle is set from Image point 1 on that to point 1 on the helper orbiting the player. Same for Bullet2, but for image points 2. Then, it flips these two, sending point 1 to 2, and 2 to 1, if the mouse.x is less than player.x(i.e to the left side of the player)

    Hopefully this helps :)

    https://drive.google.com/file/d/1oi4XqvEkr_66H6eeGC1k9HehLrJMthvA/view?usp=sharing

    EDIT: Just have to have that Bullet 2 outside of layout at the start, be destroyed haha. I missed that, but you'll see it fly into the layout right at the start of layout.

    EDIT 2: Also, one other point. Rather than using two Bullet Sprites. You could do System Create: Bullet, on both points on the PlayerTejectoryHelper, to the proper points on the TrajectoryAngleHelper(orbits the Player). And, just use a single Bullet Object to do the job of the two separate objects in the example.

  • Hopefully this helps :)

    Big thanks!! I finally realized how it should work. Unfortunately c2 doesn't have orbit behaviour, but i will try pin behaviour with "rope" pinning style

  • > Hopefully this helps :)

    Big thanks!! I finally realized how it should work. Unfortunately c2 doesn't have orbit behaviour, but i will try pin behaviour with "rope" pinning style

    Definitely. I'm happy to help :)

    If I knew you were using Construct 2, I would have tried my hand at making something similar in that version(I still have it licensed & installed). So without Construct 3, you cannot open the .cp3 right? I could put up screenshots of what I did in my small example.

    There are definitely multiple routes to get the same effect. Maybe Pin At Distance, with the "bar" style, if C2 has that? That way the helper sprite that orbits around the player stays at the same distance from the player. Then have it follow the angle of the mouse in a similar way, to what I've done.

    Then the helper sprite at the center of the Player could just rotate like it already does.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Areitia - Here's pretty much the same exact thing, but recreated in Construct 2 :)

    https://drive.google.com/file/d/1m4PoMJkmMcbcnV-QyxmfVrUjnnTlpIB-/view?usp=sharing

    Pinning with the "bar" style, worked like a treat :). Unfortunately, if using the choice of "rope", it could move closer to the Player Sprite. If the mouse moves within the length of the rope.

    Doing it in this basic way. Makes it even easier to adjust the spacing of bullets, angles, etc. Just resize one or both of the Trajectory Helpers, or change the distance from the helper moving around the Player further/closer, etc, etc. Should be easily customizable :)

    Have fun! Feel free to add me on Discord if you're on there. My handle is, Fun & Games#6077

    I enjoy helping fellow developers, when I can make time 😀. Lately, I've been trying to set aside at least an hour total each day. To help out others here in the community, and on Discord. It gives me a break from my own projects, and gets my brain working on solving/creating something else for a bit. Also helps thinking about an issue/game play mechanic envisioned, then prototyping various things quickly. Plus there is the added bonus of helping out a community member.

    Enjoy the rest of your weekend. Peace out ✌️

    Edits: Adding to this post, fixing spelling/grammar, etc. I tend to type like a shotgun blast to the keyboard. Should really proof read these things.

  • Here's pretty much the same exact thing, but recreated in Construct 2 :)

    Don't know how to thank you!! That exactly what i wanted to do!

    P.S I opened your cp3 example in free version cause i have license only for c2, so thank you very much.

  • Don't know how to thank you!! That exactly what i wanted to do!

    Excellent! You've just thanked me, and that is plenty. (Maybe give my comment a thumbs up would be cool ;)) I'm happy I could help you out over the past couple days. Just a few months back, I would have had a very hard time figuring this one out.

    I thought of the simplest way to achieve the end result, then threw it together using basic sprites. The more you play with Construct, and create various prototypes of different games and apps. The quicker you will become at visualizing what needs to happen logically. Then it's just a matter of putting it down into a layout/event sheet(s).

    I've learned over time, that it's best to keep things as simple as possible. It's always possible to expand on it, and make it more complex further down the road :)

    P.S I opened your cp3 example in free version cause i have license only for c2, so thank you very much.

    Duh... That makes sense XD. Everyone can load up a project within the free version, as long as the event/action blocks are within the limits. I was to busy thinking about achieving this same thing in C2, that I was not thinking about that, haha XD

    Best of luck! And, have a great day!

    EDIT: Another thing that helps a great deal, is keeping notes. I have a document on my Desktop. Where I've saved various formulas, for angle, distance, movement, etc, that I've either put together, or found elsewhere overtime. So I can always reference it. Sometimes I'll reference other projects I've done as well. If I've forgotten how to do something, I pulled off in the past.

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