marat Registered User |
Quote
|
2017-11-22 07:06:15 |
|
Greetings. I develop a game in the genre of first-person shooter. Therefore, I need to get a more sophisticated behavior of weapons and monsters AI. Suppose I want all weapons on the scene to have ammo counters.
Yesterday I tried to write a script for this. For this, I added the "cAmmo" field via the "this" pointer inside the behavior script function. In onAnimate function, when I pressed the left key, which plays the role of a shoot key, I incremented the ammo count (usually when the shot is fired it decrements, but for the test I increased their number). I also printed the current value of the ammo count of the gun. It worked. Then I put a cylinder on the scene and attached behavior to it, which is that when the right mouse button is clicked, the gun is cloned. In the test, the behavior script for the gun , which was cloned later, prints fewer cAmmo, as I wanted. As though all works, but I am not assured that it is correct (such examples are not present in the documentation).
Hence my question. Can I use the behavior script to store additional data parameters of scene node (ammo counts of weapons, goals of monsters). Does behavior script "this" fields shared between scene node clones or not?
|
Zoo Guest |
Quote
|
2017-11-22 21:11:11 |
|
Check out https>//marshtownmadness.com there are a lot of resources there
|