Detachable weapon on character sprite

Get help using Construct 2

Post » Fri Apr 05, 2013 7:06 am

Hi, sorry I don't really have example images, but basically, my player-character is suppose to use a spear that can be thrown at enemies. When thrown, it's suppose to then stick to whatever enemy/ground it hits, and the player-character will no longer hold a spear till they go over and pick it up.

The thing is I'm not sure which is the best way to set-up the sprite, I'm thinking the following ways:

1) Make spritesheets for holding the spear and without. When spear is thrown, switch character sprites with no-spear ones, spawn a cloned spear to be the actual projectile. Then switch back to regular sprites after 'regaining' the spear.

Or

2) Make spear fully detachable and independent of player-sprite. Pin it to image point on hand of player-character. Apply Bullet behavior as before.

Personally I'm hoping option 2 is possible, but I'm concerned with how 'floaty' and odd-angled the spear sprite would look attached to the player-character. I feel I might have to adjust it's rotation frame-by-frame indepently of the player-character, and I'm not sure if that's possible?
Create HTML5 games
B
10
S
1
Posts: 27
Reputation: 697

Post » Fri Apr 05, 2013 4:57 pm

It would be easy just to do an animation like in number 1, and use bools to switch between "spear held" and "not spear held" states.

2 is possible though. Just set an image point to his hand and every frame, if spear held is true, set the x and y to the image points x and y. You can also force the angle to be set at a certain way. Then once you throw it, set spear held to false so the spear is free, and then do your magic with the spear.
An animation would still help though for throwing just to make it look snazzy.
B
10
S
3
G
3
Posts: 234
Reputation: 3,467

Post » Fri Apr 05, 2013 5:20 pm

Option two is the best way to go, and it's probably the easier of the two.

As sushin said, on collision with spear have it set to an image point...give the spear rotation and you can set the angle, dependant on animation frame.
As long as I can move left, right and fire, I'm Happy...
B
42
S
15
G
11
Posts: 655
Reputation: 12,260

Post » Fri Apr 05, 2013 6:28 pm

like @Sushin said option 2 is the best way to do it, with Imagepoints. That is what I have seen mostly in tutorials and is the best reccomended way to do what your asking.
B
21
S
7
G
1
Posts: 128
Reputation: 3,076

Post » Sun Apr 07, 2013 1:17 am

Couldn't you pin the spear to the player, then when "space bar" is clicked, player unpins spear, apply physics impulse on spear?
B
18
S
4
G
3
Posts: 436
Reputation: 4,801

Post » Sun Apr 07, 2013 9:52 am

I'm trying to not have to use physics if I can. Mostly because if I do, I'll have to make more of my platform game physics based than originally prepared for.

I thought the Bullet behavior with the right gravity settings would work pretty much the same.

Anyway, thanks for all the feedback! It'll help to streamline what I need to do for the player sprite and weapon now. My only concern now is the same animations for both with/without spear would actually look all right, but that's something I'll handle when it comes.
Create HTML5 games
B
10
S
1
Posts: 27
Reputation: 697


Return to How do I....?

Who is online

Users browsing this forum: anty21ro, LeFuji, RookieDev, TRMG, Yahoo [Bot] and 20 guests