More -- Load & Prepare Ressources
cc.ninjarope.gfx_icon = loadgfx("weapons/ropeshooter.bmp")
setmidhandle(cc.ninjarope.gfx_icon)
cc.ninjarope.gfx_pro = loadgfx("weapons/shot.bmp")
setmidhandle(cc.ninjarope.gfx_pro)
--------------------------------------------------------------------------------
-- Weapon: Arnes Ninjarope
--------------------------------------------------------------------------------
cc.ninjarope.id=addweapon("cc.ninjarope", "Ninjarope (experimental! bugs!)", cc.ninjarope.gfx_icon,1,0) -- Add Weapon (1 use, first in round 0)
-- Draw
function cc.ninjarope.draw()
setblend(blend_alpha)
setalpha(1)
setcolor(255,255,255)
drawinhand(cc.ninjarope.gfx_wpn,7,0)
-- Aiming Laser
if getplayeraction(0)==0 then
setblend(blend_light)
setcolor(255,0,0)
setscale(1,-10)
setrotation(getplayerrotation(0))
drawimage(cc.ninjarope.gfx_pro,getplayerx(0)+7*getplayerdirection(0)+math.sin(math.rad(getplayerrotation(0)))*(200+14),getplayery(0)+3-math.cos(math.rad(getplayerrotation(0)))*(200+14))
-- Draw crosshair
if weapon_mode == 0 then
-- FOR KEYBOARD-AIMING:
hudcrosshair(0, 0)
hudinfo("Press [fire] to shoot the rope, press [fire] again to release!")
-- Draw the rope
elseif weapon_mode == 1 then
setblend(blend_alpha)
setalpha(1)
setcolor(200, 200, 200)
drawline(getplayerx(0), getplayery(0), cc.ninjarope.stack[cc.ninjarope.stack_top].x, cc.ninjarope.stack[cc.ninjarope.stack_top].y, 2)
if cc.ninjarope.stack_top > 1 then
for i=1, cc.ninjarope.stack_top-1, 1 do
drawline(cc.ninjarope.stack[i].x, cc.ninjarope.stack[i].y, cc.ninjarope.stack[i+1].x, cc.ninjarope.stack[i+1].y, 2)
end
end
setrotation(0)
setscale(1, 1)
setcolor(255, 255, 255)
-- No player animation, but new arms
playerforceframe(0, 2)
drawimage(cc.ninjarope.gfx_icon, getplayerx(0), getplayery(0)+3)
end
end
end