|Data Realms Fan Forums
|Page 1 of 1|
|Author:||kungfuchan13 [ Fri Mar 30, 2012 8:09 pm ]|
|Post subject:||Energy Bar?|
No. Not the food. Sorry if this has already been asked, but is it possible to make something similar to an energy bar, where it shows how much energy you have and each shot reduces that? So, basically, you would make a global variable and spawn particles so that you can see how much energy there is, then attach a script to the guns or the bullets to reduce the amount of energy, right? I'm not exactly certain how you would type this, so please help. All my (two) attempts at lua... Failed. But please don't just type up the code for me. Just give me pointers and stuff.
|Author:||CaveCricket48 [ Fri Mar 30, 2012 11:16 pm ]|
|Post subject:||Re: Energy Bar?|
If the energy bar is only for a single item (say, the meter represents the amount of "ammo" in a gun), you'd want it localized. The bar can simply be a multi-framed spirte where frame 0 is "empty", and as the frame number increases, the "fullness" of the bar increases until it's completely full. Then you can sync that with your ammo counter and have the bar sprite frame increase/decrease accordingly.
|Author:||kungfuchan13 [ Fri Mar 30, 2012 11:41 pm ]|
|Post subject:||Re: Energy Bar?|
Nope. I'm making it so that the script is attached to an actor that has a weapon pre-equipped that uses that energy. It's magic, so mana. Thanks. I'll try to code that. Try... If I fail and need more help, I'll post the code and my problem.
Edit: Yeah... I need help. I currently only have a code to increase the amount of mana every tenth of a second, but I want a visual representation. I remember seeing threads on animations and MOSRotatings around here somewhere, but... I can't find them. Please could you help me? I kind of want a stationary bar hovering somewhere a bit above or a bit below the actor. How should I do that? Should I just make another gib particle on the head or something and attach it higher up and animate that? Or is it possible to have it actually spawn the sprite somewhere in relation to the actor and keep it there? Well, I could just tack on a code to the sprite to make it stay somewhere in relation to the actor. Well, basically, two questions:
2. Once I create that sprite, how do I position it?
Wow. I just found CreateMOSRotating on the HTML version of the wiki, and it can't find the file for anything there...
Edit 2: Oh. And how would I attach this script to the actor? Would I have to integrate it with some other script or something?
Edit 3: Ah. Now that I think about it, the script should probably be attached to the gun. It'll be easier, too, anyways.
Okay. Starting fresh with edits. So. Basically, to create the MOSRotating, I simply make a variable with whatever name I like and use the CreateMOSRotating() function. The arguments are the preset name of the MO and the location (of the file), right?
Then I make <variable_name>.Pos.Vector = Whatever I like, so in this case, something like (self.target.PosX,self.target.PosY + 100)... Do I have to set the velocity? Well, anyways, then I'll attach a script to that MOSRotating that makes the velocity the same as the actor's.
Ah. Then I could just make the script on the gun change the frame of the MOSRotating according to the variable called "Mana." Now I just have to make a script to change the gun's magazine when I hit a certain key and make each type of ammo use a different amount of mana... Well, I have to finish coding that first and testing it. Then I can move on to the actual functions of the weapon.
|Page 1 of 1||All times are UTC [ DST ]|
|Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group