How to pick up weapons(help,capx included)

Get help using Construct 2

Post » Fri Dec 14, 2012 10:11 pm

The platform behavior was a way to get gravity working for the melee objects, it could be done many ways actually. But the goal is to pick up only one instance of a weapon without picking up the rest.
B
21
Posts: 23
Reputation: 2,429

Post » Fri Dec 14, 2012 10:15 pm

Have you tried 'pick nth instance', to pick the 1th instance?
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Fri Dec 14, 2012 10:16 pm

Theres an event that reads:

Is animation d1 playing- set wpntype value to 1
(d1 being bat)

So yes you are pretty close. We are having a problem trying to overlap an instance and only pick up that instance. But there is no such event. We tried:

player overlapping melee + pick unique ID 1. that didn't work
then we tried:
player overlapping melee + wpntype is 1. that would work, but if you have more than one of that same wpntype it would pick up both no matter how far apart.
B
21
Posts: 23
Reputation: 2,429

Post » Fri Dec 14, 2012 10:20 pm

@ ssqidter Yes we have tried that also with the same result. We are willing to change the pick up/instances code if there is an easier method.
B
21
Posts: 23
Reputation: 2,429

Post » Fri Dec 14, 2012 10:52 pm

I'm looking at your capx, but nothing seems to work for me. I can't pick up any weapons, and I have a bat moving and jumping towards me...
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Sat Dec 15, 2012 1:58 am

I haven't looked at the .capx, but what about something like:

If player overlapping weapon
Player variable 'weapon' = "none"
Pick closest weapon to player.x, player.y
- set player variable 'weapon' to weapon.type
- destroy weapon

On button to drop weapon pressed
If player.weapon="bat"
- create object bat at player.x, player.y
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Sat Dec 15, 2012 8:44 pm

This is what we did to make it work. However there are 10 different weapons. So would have to repeat this 10 different times with invert/un-invert different animations.


Weaponpic by thegamer123, on Flickr

We would like any suggestions to make it work with less coding.

@arima we have not tried that yet. Can you please look at the file?
@sqqidster yea the objects going towards you is not a big problem. the only weapon we made to work n that cap was the bat. we can now pick up weapons doing this method.
B
21
Posts: 23
Reputation: 2,429

Post » Mon Dec 17, 2012 8:38 pm

We have fixed the issue with picking up weapons. The "For Each" condition was overlooked and missed for some reason.


ProblemFixed by thegamer123, on Flickr
B
21
Posts: 23
Reputation: 2,429

Post » Tue Jul 15, 2014 9:17 pm

This is helpful, thanks
B
13
S
5
G
1
Posts: 119
Reputation: 2,292

Previous

Return to How do I....?

Who is online

Users browsing this forum: spcsmrf and 27 guests