Code archives/3D Graphics - Effects/Predator cloak

This code has been declared by its author to be Public Domain code.

Download source code

Predator cloak by *2004
A nice classy predator cloaking effect

Please note if you use this please add me 'EdzUp' to the credits of your game =)
Function EFPSDoPred( Camera, Entity, Xoffset, YOffset, FX=0 )
	;Create some temp graphics images
	Local PredBacking = CreateImage( GraphicsWidth(), GraphicsHeight() )
	Local PredImage = CreateImage( GraphicsWidth(), GraphicsHeight() )
	Local PredImage2 = CreateImage( GraphicsWidth(), GraphicsHeight() )
	Local PredImage3 = CreateImage( GraphicsWidth(), GraphicsHeight() )
	Local PredImage4 = CreateImage( GraphicsWidth(), GraphicsHeight() )

	;distance system for calculations
	Local PredDist# = EntityDistance#( Camera, Entity )

	If PredDist#>0 Then PredDist# = PredDist# /10 Else PredDist# = 0.0001

	;colour entity
	EntityColor Entity, 0, 0, 0
	EntityFX Entity, 1
	
	HideEntity Entity
	RenderWorld
	GrabImage PredBacking, 0, 0			;grab background
	ShowEntity Entity
	RenderWorld
	GrabImage PredImage, 0, 0			;grab templates
	GrabImage PredImage2, 0, 0
	GrabImage PredImage3, 0, 0
	GrabImage PredImage4, 0, 0
	
	Cls
	DrawImage PredBacking, 0, 0			;so there is no black bits
	DrawImage PredBacking, ( XOffset /PredDist# )*4, ( YOffset /PredDist# )*4
	DrawImage PredImage2, ( XOffset /PredDist# )*3, ( YOffset /PredDist# )*3
	DrawImage PredImage3, ( XOffset /PredDist# )*2, ( YOffset /PredDist# )*2
	DrawImage PredImage4, XOffset/PredDist#, YOffset/PredDist#
	DrawImage PredImage, 0, 0

	EntityColor Entity, 255, 255, 255	;reset entity
	EntityFX Entity, FX
	
	FreeImage PredImage2				;free images
	FreeImage PredImage3
	FreeImage PredImage4
	FreeImage PredImage
	FreeImage PredBacking
End Function

Comments

TartanTangerine (was Indiepath)2004
Has anyone actually used this? I can't get it to work :(


jfk EO-111102005
Not yet, but it's obvious what it does, so you should be able to make it work.


Rook Zimbabwe2005
Very interesting... I was having porblems until I realized that I still had to say what cameraentity I wanted to use this!
-RZ


mrtricks2005
Is GrabImage faster than CopyRect?


warwulf2005
u know whats realy nice, when u actuly include an example in ur code


Buggy2007
Yeah. An example would be great!


Code Archives Forum