Something simple: bullet direction.

For questions about using Classic.

Post » Wed Dec 16, 2009 8:17 am

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?
B
4
S
2
G
4
Posts: 164
Reputation: 1,878

Post » Wed Dec 16, 2009 8:35 am

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. ;)
B
3
S
2
G
3
Posts: 628
Reputation: 2,531

Post » Wed Dec 16, 2009 9:01 am

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.
B
4
S
2
G
4
Posts: 164
Reputation: 1,878

Post » Wed Dec 16, 2009 9:32 am

[quote="Kisai":3pkxvwel]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.[/quote:3pkxvwel]

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.
B
3
S
2
G
3
Posts: 628
Reputation: 2,531

Post » Wed Dec 16, 2009 10:21 am

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).
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Wed Dec 16, 2009 11:21 am

[quote="Ashley":bhsdvb4d]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.[/quote:bhsdvb4d]

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).[/quote:bhsdvb4d]

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.
B
4
S
2
G
4
Posts: 164
Reputation: 1,878

Post » Wed Dec 16, 2009 11:35 am

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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests