Something simple: bullet direction.

This forum is currently in read-only mode.
From the Asset Store
This pack contains 10 types of bullet effects, with different shapes and colors.
  • I'm wondering, does a bullet, when spawned, only go to the right unless specified by the keyboard? It seems that to do some diagonal shooting with a platformer, I gotta enter events like this:

    MouseKeyboard: Key Up arrow is down

    MouseKeyboard: Key Right arrow is down

    HandSet angle to 315

    Is it SUPPOSED to be like that, or should bullets be able to be shot diagonally naturally, and somehow I'm just missing that?

  • AFAIK the right is 0 degrees, and the angle everything faces by default.

    Look at a sprite and you should see a small arm coming off the center of it, moving that will change the angle within the layout and should change the default angle for that particular sprite then.

    The bullet behavior I think is made to go in the direction the spawning object is facing. But I doubt it would be that difficult to make it choose a random direction either.

    Since this is the grapple, right? Are you sure using the bullet behavior is a good choice? While more in depth, you might find you get more control by setting up it's behavior through events alone, and just use the bullet behavior for bullet like objects. (I know, I know, depending on deployment, a grapple could be considered a projectile). But for your purposes maybe something else would work better.

    Personally I'm tempted to suggest using physics for it.

  • You know that my usage of bullet behavior is for the grapple thingy shooting from my character, right? ^^ The grapple actions will be done seperately, done mostly from a personal .cap someone posted a year ago. I'll just be copying that. Think Samus's Grapple Beam from Super Metroid.

  • You know that my usage of bullet behavior is for the grapple thingy shooting from my character, right? ^^ The grapple actions will be done seperately, done mostly from a personal .cap someone posted a year ago. I'll just be copying that. Think Samus's Grapple Beam from Super Metroid.

    Yep I knew that. I've never played Metroid Prime before (was a computer dude not a console dude), so went to have a look on youtube, saw a few examples of that particular grapple.

    I'd totally make it physics now, lol. Could do something like switch all the movement controls off once the grapple has caught something and just use physics and various forces to control swinging about and so on. The beam could I would think be easily made to hinge together too. Or heck, I wonder if bones work with physics, Ashley did mention the possibility of ragdolls eventually, and it's the same principal.

    Yep, physics for the grapple would be awesome!

    For the actual firing "mechanism" you could do a search around the forum for a recent thread (from within the last three weeks I think), where someone posted an example of finding the closest solid object from a particular direction, which I would think could be used for the point of attaching your grapple (if within a certain distance) then you just follow that up with the actual animation of the grapple being fired and moving toward the target, attach the physics 'beam' and all that jazz, that would be what the player see's and bobs your grapple wielding uncle.

    Wait a minute.. was that you who posted that example I'm talking about? Cause it looks like something very useful for what you're doing.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Bullets spawn at the angle of the object that spawned them. So if your object angle is always 0 degrees (right), your bullets will always spawn at 0 degrees.

    You should probably spawn the bullet at the angle of the player's motion, rather than the display angle of the sprite (which is what Sprite.Angle refers to).

  • Bullets spawn at the angle of the object that spawned them. So if your object angle is always 0 degrees (right), your bullets will always spawn at 0 degrees.

    I didn't see that happening, but the collision box object kidna only has one animated direction, so... that might be why. I didn't think it'd matter. Guess it does. ^^

    [quote:bhsdvb4d]You should probably spawn the bullet at the angle of the player's motion, rather than the display angle of the sprite (which is what Sprite.Angle refers to).

    Er... is there a way to get the information of a player's motion? That would be pretty helpful, especially if I could allow for things like, walking forward, push up, shoot, and then you get an up-left diagonal direction of shooting.

  • There's expressions in platform to get the player's vector of motion right? .VectorX and .VectorY, or .dx and .dy, or something like that. In that case angle(0, 0, dx, dy) gives you the angle of motion.

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