Joey |
i was working on battle wounds today. i finished the intro. now i want to test out the battle system. can someone tell me all the steps i need to do to set a certain key to so an action when i press it? i wanted to do insert, so this is what i did. i set the number it is in the key logic one to c30. i went into the battle system logic (logic 200) and made it so if(c30){ do this is this set up the right way? i want it to do an animation, and subtract like 2 from variable 50. variable 50 is this tests guys health, which is at 6 right now. i press the insert key, and nothing happens :(. how do i set a key to do something? |
Eigen |
First go to logic 91. There add set.key(0,82,c35); for example. Now go to your logic 200 and put if(controller(c35)){ v60 -= 1; That should do it. -Eigen |
Joey | i think thats what i did, but ill try. thanks eigen. |
Joey | ok another problem :- |
Eigen |
Maybe try using start.cycling(o0); before end.of.loop comand and try putting the animate.obj comand after set.view(o0,2); -Eigen |
Joey | ill give it a shot |
Andrew_Baker |
Whoa, whoa, whoa, young man. Why do you have the code to initialize the object in a conditional block? Wouldn't it be a bit safer in the head of the room logic (ie, within if (new_room) { })? Then, you could make all of the actions on it within the conditional block. Are you temporarily replacing the ego with a different animated object? If so, I can totally understand. Did it the same way meself. |
Joey | what im doing, is when you get into a fight, it goes to logic 200 which has its own picture, and loads the character you ran into from a flag, and changes your ego to the view of you with a sword out. i dont really understand what you mean though. do you mean put it at the top, before show.pic() ? |
Andrew_Baker |
Yes. Otherwise, when the flag is true, then it is reinitializing that image... which you don't really want. I don't know if that is your bug, but is a simple enough optimization that should reduce some overhead. If you need multiple different animations, you can put them all in loops within the same view. |
Joey | i just need loop 0 to cycle through until the end, then go back to cel 0 of it and wait. then once i press insert again, it will cycle the cels until the end of loop, then go back. |
Andrew_Baker |
But what I'm trying to tell you is that the best place for animate.obj(o0); load.view(2); set.view(o0,2); position(o0,90,88); draw(o0); is like this: if (new_room) { //some other code here animate.obj(o0); load.view(2); set.view(o0,2); position(o0,90,88); draw(o0); } In fact, when I look at your code again... you should never have to use the command, animate.obj(o0). The ego is automatically animated, isn't it? Either way, try using something more like this if (new_room) { //Initialize a brand new object to replace the ego temporarily. //The ego doesn't like using a lot of the normal animation //functions, in my experience. //some other code here animate.obj(o1); load.view(2); set.view(o1,2); position(o1,90,88); draw(o1); } if(controller(c35) || f16) { //Press TAB to run loop, not sure whether it should //be f16 or !f16 program.control(); //keep the ego from moving erase(o0); end.of.loop(o0,f16); } //you were using an extra } here, and you don't need that error message here if (f16) { //Not sure whether it should be f16 or !f16 //but this block should be called when the end.of.loop() ends erase(o1); draw(o0); player.control(); } This is a bit crude, and it won't solve all of your problems, but it should be a step in the right direction. Remember that you should keep graphic initializations in the header, and that you should never have to reinitialize the ego object. |
Kon-Tiki |
Joey: one good tip. Look at my FF Battle System. I'm not telling you to use it, but it shows all those things. If you don't want to wrestle your way through the code, I'm going to make a tutorial for that one of these days. Reading that'll explain those problems step by step too ;) -Kon-Tiki- |
Joey | Kon, mines different then yours though. Ill still take a look at it, but mine is gonna be different than yours. |
Kon-Tiki |
I know, but certain aspects come back in every single kind of battle system, like key input, responding to certain inputs, etc. You can get those out of my battle system. It'll save you alot of headaches and posts. -Kon-Tiki- |
Andrew_Baker | Also, check out the VG final battle with the Dream King for what your code should NOT look like :D |
Joey | lol. whats VG though? |
Eigen |
Voodoo Girl.... ::) ;) -Eigen |
Joey | lol oh yeah. |
rwfromxenon |
... Joey ... I can't believe you did that ;D ::) ;D |
Joey | lol, did what? |
Kon-Tiki |
Sounding like a moron. Quit it ::) -Kon-Tiki- |
Joey | oh. vg. ::) i thought you were talking about that hentai thingy. anyway, we are off topic, and i dont want this thread locked. ill look at the logic kon tiki. |