Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Announcements and Showcase
Weapon change

iranking
Registered User
Quote
2019-03-11 18:29:56

What is the best way for making a weapon change system?if give me a source i will be so happy


DeltaXGames
Guest
Quote
2019-03-12 00:10:26

Hey, Here's some code from my game, I hope it helps you learn how to make this,
https://pastebin.com/CQAMsqJ9

You might not understand it completely, because I write code weird and fail to comment where necessary but if you have any questions just send me a message on facebook

https://www.facebook.com/deltaxgames


iranking
Registered User
Quote
2019-03-12 07:16:55

I dont have facebook
This ia behaivier?or i shoul change some parts?


DeltaXGames
Guest
Quote
2019-03-16 08:51:03

No it's not a behavior. Here's how I added it to my project.
Click on the root scene node and add a "on first drawing do something" behavior . Then click that and add an "Execute Javascript" action, paste the code there. Rename the weapons in my weapon array to be the same with the weapons you used in your game. Make sure all the weapons are not visible, uncheck this attribute in all the guns.
Now you need to add two "when a key is pressed do something" behavior,one for switching forward and and another for switching back between weapons. Just execute this JS when someone clicks the next weapon key

nextWeapon();

and

previousWeapon();

for when the player clicks the previous weapon key.

And please by all means change it, it's very sloppy code and it includes a lot of things that are very specific to my game and may not be needed in your project. I didn't have time to trim out those parts.


xanimalkingx
Registered User
Quote
2019-03-16 10:57:28




kiki300
Registered User
Quote
2019-03-26 20:21:59

Then click that and add an "Execute Javascript" action, paste the code there. Rename the weapons in my weapon array to be


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Inte?national" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact