How to code Projectile coding properly

Started by J Dog, September 04, 2007, 09:36:33 PM

Previous topic - Next topic

J Dog

Okay, while I'm working on my creation, I decided to begin coding a projectile attack.  I placed in the available coding that was offered.  However, I can't seem to do it right.

Here's the way I got it:

I have the sprite animation to launch the projectile as 1000 in my .AIR document.  The projectile itself is animation 1001.  The collision animation is 1010.  The projectile is going to continue unless something hits it.

But, I'm a bit confused about this and whenever I tried to do something, I get the error in which the program can't "precache" what I written.  Can someone help me here?
Nothing to present... yet.  I am a horrible procastinator.

Chosen_01

Post your projectile code. It sounds like something simple. It usually is.

Cybaster

Post your cmd also. Mugen should be telling you what part he has problem precaching.

J Dog

Well, here's my CMD:


[Command]
name = "Beta Energy Shot"
trigger1 = "F, x"
time = 15


And here's part of the CNS:


[State 1000, 5]
type = projectile
trigger1 = time = 0
animno = 1001
animhitno = 1000...


It hit me:  The "animhitno" is actually the hit animation the person must face whenever they get hit (5000, 5010, 5030, etc.).  I just found that out as I was coding this in.

But if I experience full problems, I'll post the entire code.
Nothing to present... yet.  I am a horrible procastinator.

J Dog

Um... here's where I'm at now on it (I correctly fixed the problem, I think)


;------------------

;Beta Shot
[Statedef 1101]
type    = S
movetype= A
physics = S
poweradd= -50
ctrl = 0
anim = 1050
velset = 0, 0


[State 1101, 2]
type = helper
trigger1 = Animelem = 1
stateno = 1002
pos = 0, 0
postype  = p1
facing = 1
ownpal = 0
keyctrl = 0


[State 1101, 3]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

-------------------------------------------------------------

; Shot 2
[Statedef 1002]
type    = S
movetype= A
physics = S
poweradd= -50
anim = 1001

[State 1002, 2]
type = HitDef
trigger1 = time = 0
attr = S, NA
damage = 40
priority = 9
pausetime = 0,30
guardflag = HA
ground.type = light
ground.velocity = 0, 0
fall = 0

[State 1002, 2]
type = velset
trigger1 = time > 0
x = 8
y = 0

[State 1002, 3]
type = destroyself
trigger1 = movehit
trigger2 = movecontact


And the CMD files


; Basic Shot
[State -1, Shooting]
type = ChangeState
value = 1101
triggerall = command = "Shoot"
triggerall = power >= 50
trigger1 = statetype = S
trigger1 = ctrl

[Command]
name = "Shoot"
command = z
time = 15


Did I do it right?
Nothing to present... yet.  I am a horrible procastinator.

Bastard Mami

it should work now. to fix problem that will arise later, you need to adda  nothitby, so it can't ge thit by regular attacks; the projectile's hitdef can benefirt onm being S,NP instead of S, NA ; you can also, add a "projectile dissapearing state" that will have the destroy self, and in the projectile state instead of destroyself, you put a changestate to that state; as well as adding a hitoverride for AP, so if the projectile is hit by another projectile, it goes to the dissapear state.

J Dog

Quote
it should work now. to fix problem that will arise later, you need to adda  nothitby, so it can't ge thit by regular attacks; the projectile's hitdef can benefirt onm being S,NP instead of S, NA ; you can also, add a "projectile dissapearing state" that will have the destroy self, and in the projectile state instead of destroyself, you put a changestate to that state; as well as adding a hitoverride for AP, so if the projectile is hit by another projectile, it goes to the dissapear state.

Alright, I'll do that.

BTW, you got an addictive-to-look-at avatar  8).
Nothing to present... yet.  I am a horrible procastinator.