LoginLogin

Coding help? Attacking, Weapons and Armour

Root / Programming Questions / [.]

HiroshuCreated:
So far all I've been able to do is make a map area, recoloured a SmileBASIC character and got him to move. But I'm stumped on how to make him hold weapons and attack. I already made the weapons but that's about it. It's just a test game that I'll use for reference in my own game

You can either make more sprites for your character to use when they're holding a weapon, and another set to use for the attack animation; or you can use SPLINK to attach a weapon sprite to your character sprite. If you have various weapons, then linking them to your character sprite is probably the easiest way to do it, otherwise you'll be making a lot of sprites. Also, in your game, remember to control how frequently an attack can be repeated and stop the player from spamming the attack button. You could have a timeout value on each weapon, measured in frames, and compare that to the number of MAINCNT frames that have elapsed since the last attack; letting you have quick and slow attacks, for example.

Alright I was able to SPLINK it but I can't figure out how to make him hold it or swing it, still kinda new at this But I was able to make him look like he's holding the weapon

Alright I was able to SPLINK it but I can't figure out how to make him hold it or swing it, still kinda new at this But I was able to make him look like he's holding the weapon
Make it so that if BUTTON() is 16 or 32 (A or B button)is true Then animate sword to move a few pixels forward and then back, or rotate, or however you want it to look.

How would I do that in Coding language? Still... not sure...

IF BUTTON(2) AND #A THEN
    SPANIM 'whatever animation you want'
ELSEIF BUTTON(2) AND #B THEN
    SPANIM 'other animation or something
ENDIF
This might work to allow some differing animations. Could probably be optimized and made more useful but it's a start :P

Will it cause a problem if I have a B=BUTTON() already used for walking? Or would I just add to it? And the Animations I assume to use SPANIM and I am but I just can't make him move it the way I want this is frustrating, haha But I really wanna learn this

Will it cause a problem if I have a B=BUTTON() already used for walking? Or would I just add to it? And the Animations I assume to use SPANIM and I am but I just can't make him move it the way I want this is frustrating, haha But I really wanna learn this
If you already have button input just extend it. Maybe IF B AND #A THEN 'animationy stuffs.
but I just can't make him move it the way I want
Do you mean the player or the sword?

Yeah I should be more specific, I can't seem to get the Character to hold the Sword correctly. I've used SPANIM 1,"R",60,90,0 after the THEN but no angle suits the holding unless I use "XY" to position it to the right of him But so far thank you for the help, I actually have him doing actions when I press A, it's great

Yeah I should be more specific, I can't seem to get the Character to hold the Sword correctly. I've used SPANIM 1,"R",60,90,0 after the THEN but no angle suits the holding unless I use "XY" to position it to the right of him But so far thank you for the help, I actually have him doing actions when I press A, it's great
Use SPHOME to make the sprites rotate around that point! :D Then the sword can rotate around, say, the hilt, using SPANIM.

Haven't been working on my game because of a sickness but I'm getting over it, I decided instead of making the swords handle turn to make it look like the character is holding it, I instead just angled the weapon sprite itself. But the weapon swings in a wide ark then freezes a few pixels away from my character and no matter how much I've been reading on it I can't get the right angle and animation on the swing I should just upload the game so it'd be easier to get what I'm saying