Weapons System

For questions about using Classic.

Post » Thu Nov 10, 2011 10:01 pm

So i was wondering if anyone had any ideas on making a COD style weapons system? You have 2 slots for weapons and can switch any weapon you find with a weapon you're currently holding. I've tried some ideas with it but i couldnt get anything working.
B
4
S
1
G
1
Posts: 5
Reputation: 1,260

Post » Thu Nov 10, 2011 10:56 pm

Global variables - one for each weapon slot and one that says which slot is active. As you pick up/switch/use weapons just consult the variable which tells the game which slot to use.
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Fri Nov 11, 2011 1:09 pm

OK i tried that out and it seems to be the best option so thank you.
I was wondering if you could post a .cap or maybe go into more depth because im still struggling a bit. i could be missing something obvious here.
B
4
S
1
G
1
Posts: 5
Reputation: 1,260

Post » Fri Nov 11, 2011 1:44 pm

Heh, I was being kinda vague to promote thinking about the problem and thus make it easier the next time.

But ok, made you a cap - it's not really commented (for now?), but at the same time it's simple enough: Grab it!

So what you have there is a little tank that has two weapons bays - currently there are two types of weapons - a rapid fire gun and a slower spread shot. Each bay can have either weapon and you can switch between the bays by Right clicking.

To test the pickup system random weapon pickups gets spawned every 3 seconds. I haven't put much thought into them so sometimes you pick one up and the next one spawns right on top of you, etc. But anyways - you can pick up the weapon and it'll replace the weapon in your current bay and become the active weapon.

Have a look around, let me know if anything is unclear. I may improve it in the background, but the general idea will stay the same.
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests