Pick up and throw objects with the same button

Get help using Construct 2

Post » Fri Dec 21, 2012 12:59 am

Hello all,


I have my player pick up objects and throw them using the "X" button. I have the throw-able object behaviors set as the following. Physics, Pin and Bullet. Looking at some tutorials here on the Constuct 2 fourms I manage to make the player throw the objects. However of course, the throw and Pick up being set as the same button the Player instantly throws the object upon picking it up. Is there any way to set this as the same button like in games like Super Mario Bros. 2, Klonoa, Chip n dale for the NES? Or do I really need to make and alternative button for throwing?      
B
4
Posts: 35
Reputation: 445

Post » Fri Dec 21, 2012 2:03 am

Hey ChromeGadget,

Would it work for your game to use the same button but have the pick-up and throw distinguished by whether the button is held or released? e.g. hold to pick-up the object, release to throw it?
B
16
S
6
G
2
Posts: 152
Reputation: 3,764

Post » Fri Dec 21, 2012 2:09 am

Is this what you're after?

Let me know with @sqiddster if it doesn't work.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Fri Dec 21, 2012 4:49 am

@Sqiddster

Yes Sqiddster that's it, right on man! So far it's working fine just need to implement it into my engine. Thank you mate!

@Space Ape

Hey Space Ape

Yea, I thought about using the hold button release to throw object feature in my game but the thing is I plan on making laser guns and cannons in my game as pick up objects. I don't want my player to constantly hold a button for long periods while trying to shoot (the shooting button being a separate button) It can be quite tedious at least in my standards. Thank you for your thoughts though Space Ape I appreciate it!     
B
4
Posts: 35
Reputation: 445

Post » Fri Dec 21, 2012 7:18 am

Yeah, I'm still trying to figure stuff out, too.

So what was the solution? I didn't get a chance to download sqiddster's capx file yet.
B
16
S
6
G
2
Posts: 152
Reputation: 3,764

Post » Fri Dec 21, 2012 11:25 am

Glad it worked out for you.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Sat Dec 22, 2012 6:28 pm

@Sqiddster

Hello again, I do have one small question regarding throw engine. I have successful implement the engine into my game. However, I am having difficulties changing the direction of the laser gun. I would like to have the laser gun face the direction the player is facing.

On the "Is Carrying" I tried adding a code like "laserGun Set angle to PlayerMask.Angel degrees". It sorta work but when you press the left button or facing left the laser gun flips upside down. Can this be fixed some how?
    
B
4
Posts: 35
Reputation: 445

Post » Sat Dec 22, 2012 6:58 pm

@ChromeGadget
squiddster seems to be flown by the questions :D
Don't worry , Your Awesome Game Dev Super-Whiteclaws is here to help !
...
tip of today !
You can do that in z easy steps !
First of all , your gun need to be defaulted to the angle of the player ( By Default , the gun nozle needs to point toward the player view direction )
Next , Add the following event to your game ( - = Sub-events , * = Action)
Is Carrying
- If Player.Angle = 0
* Set Mirrored to Not Mirrored
- Else
* Set Mirrored to Mirrored

And you are done !
P.S. The Mirrored action can be found in the Gun Actions Section

Cheers !
B
34
S
16
G
16
Posts: 2,222
Reputation: 16,564

Post » Sat Dec 22, 2012 9:14 pm

Yep, Whiteclaws is correct. If you set the angle it will naturally flip so just mirror it.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Mon Dec 24, 2012 6:35 pm

Hotdogit It worked!! Thank you Whiteclaws!
B
4
Posts: 35
Reputation: 445

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 0 guests