//no code
Hey, I've been scouting varies posts looking for how to codes varies attacks but I have not been able to find any help for it. I'm trying to make a one piece anime fighting game. I'm focusing right now on just getting on DF coded so I can see how it needs to be coded I'm trying to code the rubber pistol, but I can't think of how to do it. I want it to hit 2 blocks out
xxxx
xo--
xxxx
o being the player and -- is the punch.
any help please.
Below, I will show you how to implement a singleton attack system:
Singletons are single-reference objects, that only need to be created once.
This means that if we have 100 attacks in the game, we only need to
This is not the best way to ago about this, but it really doesn't matter, because it works better than about 90% of what else you are going to see other people using out there. Optimally, I'd prefer to not use per-type attacks, and instead build *kinds* of attacks, then initialize them with different values that affect the outcome.
Now that we have all the groundwork set up, we can start defining some attacks, as well as populate the global list of available attacks.
And then we have to set up our mobs to be able to use attacks.
The reason I set up known attacks to be temp, is because if we don't, you'll wind up saving all the attacks in a savefile whenever you save your players. You don't need to do this. You actually only need to save the name of each attack known, so you can get away with just passing the names into the savefile, then reloading the string name, and searching the global attacks variable in order to find the attack again after the player's being loaded.
This will cut down on your savefile size, and allow you to remove attacks from the game later.
Of course, you are still going to need a way to show the attacks to the player so they can click on them and use them.
For a quick and dirty way to do this:
This is obviously, a very, very simple system, but it should at least get you there. Also, your attacking things from two tiles away? Yeah, that's what test1 does.