Ooops
November 24, 2020, 06:59:04 AM

Author Topic: [bb] Predator cloak by * [ 1+ years ago ]  (Read 822 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] Predator cloak by * [ 1+ years ago ]
« on: June 29, 2017, 12:28:38 AM »
Title : Predator cloak
Author : *
Posted : 1+ years ago

Description : A nice classy predator cloaking effect

Please note if you use this please add me 'EdzUp' to the credits of your game =)


Code :
Code: BlitzBasic
  1. Function EFPSDoPred( Camera, Entity, Xoffset, YOffset, FX=0 )
  2.         ;Create some temp graphics images
  3.         Local PredBacking = CreateImage( GraphicsWidth(), GraphicsHeight() )
  4.         Local PredImage = CreateImage( GraphicsWidth(), GraphicsHeight() )
  5.         Local PredImage2 = CreateImage( GraphicsWidth(), GraphicsHeight() )
  6.         Local PredImage3 = CreateImage( GraphicsWidth(), GraphicsHeight() )
  7.         Local PredImage4 = CreateImage( GraphicsWidth(), GraphicsHeight() )
  8.  
  9.         ;distance system for calculations
  10.         Local PredDist# = EntityDistance#( Camera, Entity )
  11.  
  12.         If PredDist#>0 Then PredDist# = PredDist# /10 Else PredDist# = 0.0001
  13.  
  14.         ;colour entity
  15.         EntityColor Entity, 0, 0, 0
  16.         EntityFX Entity, 1
  17.        
  18.         HideEntity Entity
  19.         RenderWorld
  20.         GrabImage PredBacking, 0, 0                     ;grab background
  21.         ShowEntity Entity
  22.         RenderWorld
  23.         GrabImage PredImage, 0, 0                       ;grab templates
  24.         GrabImage PredImage2, 0, 0
  25.         GrabImage PredImage3, 0, 0
  26.         GrabImage PredImage4, 0, 0
  27.        
  28.         Cls
  29.         DrawImage PredBacking, 0, 0                     ;so there is no black bits
  30.         DrawImage PredBacking, ( XOffset /PredDist# )*4, ( YOffset /PredDist# )*4
  31.         DrawImage PredImage2, ( XOffset /PredDist# )*3, ( YOffset /PredDist# )*3
  32.         DrawImage PredImage3, ( XOffset /PredDist# )*2, ( YOffset /PredDist# )*2
  33.         DrawImage PredImage4, XOffset/PredDist#, YOffset/PredDist#
  34.         DrawImage PredImage, 0, 0
  35.  
  36.         EntityColor Entity, 255, 255, 255       ;reset entity
  37.         EntityFX Entity, FX
  38.        
  39.         FreeImage PredImage2                            ;free images
  40.         FreeImage PredImage3
  41.         FreeImage PredImage4
  42.         FreeImage PredImage
  43.         FreeImage PredBacking
  44. End Function


Comments :


TartanTangerine (was Indiepath)(Posted 1+ years ago)

 Has anyone actually used this? I can't get it to work :(


jfk EO-11110(Posted 1+ years ago)

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


Rook Zimbabwe(Posted 1+ years ago)

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


mrtricks(Posted 1+ years ago)

 Is GrabImage faster than CopyRect?


warwulf(Posted 1+ years ago)

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


Buggy(Posted 1+ years ago)

 Yeah.  An example would be great!


 

SimplePortal 2.3.6 © 2008-2014, SimplePortal