Mar 3, 2014 at 11:15 PM
Join Date: Apr 5, 2013
Location: In my mind and of my body.
Posts: 1640
Age: 27
Pronouns: he/him
..............
Ok, Uhh, give some time and I'll rewrite the code to the projectile. (no, it's fine, I WILL find the answer)
In the meantime just use only the code to the boss that I gave you.
(this has just been hell and back to get this done hasn't it?)
-=-=-=-=-=-=-=-=-=-=-
Sweet merciful Eggman, I FINALLY GOT IT TO WORK!
Code:
;ANP 0001 = start attacking player
;ANP 0007 = dead
offset NPC276
#define
npc.jump=[ecx+1C]
localvar1 = [EBP-14]
localvar2 = [EBP-18]
localvar3 = [EBP-1C]
jump_height = 400
jump_gravity = 15
jump_length = 300
range_check = 6400
L_framerect_distance = 0
U_framerect_distance = 40
#enddefine
push ebp ;This starts the code
mov ebp, esp
sub esp,13C
mov dword [EBP-10],0
mov dword [EBP-C],0
mov dword [EBP-8],0
mov dword [EBP-4],0
setpointer
cmp npc.health, 0
je :statedead
;direction check
mov eax, PlayerXpos
cmp npc.X, eax
jl :face_right
mov npc.direction, 0
jmp :end_direction
:face_right
mov npc.direction, 2
:end_direction
mov eax, npc.scriptstate
jmp [eax*4+:StateTable]
;-----FIRE (ground)-----
:statefire
add npc.y 5FF
mov npc.framenum, 0
inc npc.objecttimer
cmp npc.objecttimer, 15
jge :fireproj
mov npc.framenum, 3
jmp :render
:fireproj
mov npc.framenum, 4
cmp npc.objecttimer, 21
je :create_object
:Fired_proj_ground
cmp npc.objecttimer, 30
jl :render
mov npc.objecttimer, 0
inc npc.scripttimer
push 7
push 0
call RANDOM
add esp, C
setpointer
cmp npc.scripttimer, eax
jge :jump_prep
jmp :render
:create_object
MOV EAX,DWORD PTR SS:[EBP+8]
MOV DWORD PTR DS:[EAX+68],4
MOV ECX,DWORD PTR SS:[EBP+8]
MOV EDX,DWORD PTR DS:[ECX+0C]
SUB EDX,DWORD PTR DS:[49E658]
PUSH EDX
MOV EAX,DWORD PTR SS:[EBP+8]
MOV ECX,DWORD PTR DS:[EAX+8]
SUB ECX,DWORD PTR DS:[49E654]
PUSH ECX
CALL 004258E0
ADD ESP,8
MOV BYTE PTR SS:[EBP-1],AL
MOV DL,BYTE PTR SS:[EBP-1]
PUSH EDX
CALL 004258B0
ADD ESP,4
SHL EAX,2
MOV DWORD PTR SS:[EBP-0A0],EAX
MOV AL,BYTE PTR SS:[EBP-1]
PUSH EAX
CALL 004258C0
ADD ESP,4
SHL EAX,2
MOV DWORD PTR SS:[EBP-9C],EAX
PUSH 100
PUSH 0
PUSH 0
MOV ECX,DWORD PTR SS:[EBP-0A0]
PUSH ECX
MOV EDX,DWORD PTR SS:[EBP-9C]
PUSH EDX
MOV EAX,DWORD PTR SS:[EBP+8]
MOV ECX,DWORD PTR DS:[EAX+0C]
PUSH ECX
MOV EDX,DWORD PTR SS:[EBP+8]
MOV EAX,DWORD PTR DS:[EDX+8]
PUSH EAX
PUSH 115
CALL 0046EFD0
ADD ESP,20
setpointer
cmp npc.scriptstate, 1
je :Fired_proj_ground
jmp :jump_vel_handler_Y
:jump_prep
mov npc.scriptstate, 3
mov npc.objecttimer, 0
jmp :render
;-----JUMP-----
:statejump1 ;squat before jump
inc npc.objecttimer
cmp npc.objecttimer, 10
jg :statejump2
mov npc.framenum, 2
jmp :render
:Statejump2 ;prep for jump (one frame)
mov npc.framenum 7
mov npc.scriptstate, 5
mov npc.objecttimer, 0
cmp npc.direction, 2
je :right_jump_prep
mov npc.jump, 0
jmp :left_jump_prep
:right_jump_prep
mov npc.jump, 2
:left_jump_prep
jmp :render
;objecttimer = open/close arms timer
;scripttimer = jumping timer
:Statejump3
cmp npc.jump, 2
je :right_jump
add npc.X -jump_length
jmp :left_jump
:right_jump
add npc.X jump_length
:left_jump
inc npc.objecttimer
cmp npc.objecttimer, 10 ;before arms closed
jge :Statejump4
jmp :jump_vel_handler_Y
:Statejump4
mov npc.framenum, 5 ;closed arms
cmp npc.objecttimer, 15
jg :jumpfire
jmp :jump_vel_handler_Y
:jumpfire
mov npc.framenum, 6
cmp npc.objecttimer, 20 ;time between firing
je :create_object
cmp npc.objecttimer, 28
jl :jump_vel_handler_Y
mov npc.scriptstate, 5
mov npc.objecttimer, 0
:jump_vel_handler_Y
add npc.Y -jump_height ;jump heigth
add npc.movey, jump_gravity ;gravity pull
mov eax npc.movey
add npc.y eax
mov edx, npc.collision
and edx, 8 ;check if hit floor
jne :done_jump
jmp :render
:done_jump
mov npc.scriptstate, 2 ;go to state lightning
mov npc.scripttimer, 0
mov npc.objecttimer, 0
jmp :render
;----------------------------------------------------
:StateLightning
add npc.Y 5ff ;gravity
mov npc.framenum, 3
inc npc.objecttimer
cmp npc.objecttimer 30
je :lightning
jl :render
mov npc.framenum, 4
cmp npc.objecttimer, 60
jl :render
mov npc.scriptstate, 3
jmp :render
:lightning
push 140
push 0
push 0
push 0
push 0
setpointer
mov eax PlayerYPos
push eax
mov eax PlayerXPos
push eax
push 14D
call 46efd0
add esp,20
setpointer
mov npc.scriptstate, 1
jmp :render
:stateDead
;inc npc.scriptstate
;push 0
;push 36
;call PlaySound
;add esp, 8
:statedead2
add npc.Y 300 ;gravity
mov edx, npc.collision
and edx, 8 ;check if hit floor
jne :cont_die
add npc.Y 5ff
:cont_die
mov npc.framenum, 8
mov npc.flags, 200
mov npc.damage, 0
jmp :render
;---------------------
:stateIdle
add npc.y 5FF ;gravity
mov npc.objecttimer, 0
mov npc.framenum, 0
inc npc.frametimer
cmp npc.frametimer, 30 ;breathe check
jl :render
mov npc.framenum, 1
cmp npc.frametimer, 60
jl :render
mov npc.frametimer,0
:render
xor eax, eax ;mov eax L_framerect_distance
mov eax,npc.framenum
imul al, al, 20
mov npc.DisplayL,eax
add eax,20
mov npc.displayR,eax
mov eax, U_framerect_distance
cmp npc.direction, 2
jne :render_left
add eax 28
:render_left
mov npc.displayU,eax
add eax,28
mov npc.displayD,eax
:end_of_code
mov esp, ebp
pop ebp
retn
:StateTable
print :StateIdle ;<ANP0000
print :StateFire
print :StateLightning
print :Statejump1
print :Statejump2
print :Statejump3 ;<ANP0005
print :Statejump4
print :statedead
print :statedead2
There.
Oh yeah, and one more thing, when jumping in tight spaces, it can get stuck in an upper right corner.
Other then that it should work perfectly, no solid smoke or anything.
The error turned out to be the homing function.
Have fun. /\_/\