Advertisement
Guest User

Untitled

a guest
May 17th, 2018
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Haxe 1.16 KB | None | 0 0
  1. if (effectSprite == null){
  2.     effectSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height);
  3.     var wave:FlxWaveEffect = new FlxWaveEffect(FlxWaveMode.START, 2, FlxG.width/2, 2, 5, FlxWaveDirection.HORIZONTAL);
  4.     var water:FlxEffectSprite = new FlxEffectSprite(effectSprite, [wave]);
  5.     water.camera = FlxG.cameras.list[1];
  6.     add(water); //adds the wavey water
  7. }
  8.            
  9. var w:FlxPoint = new FlxPoint(0 - FlxG.camera.scroll.x, 112 - FlxG.camera.scroll.y);
  10.            
  11. effectSprite.visible = false;
  12. effectSprite.drawFrame();
  13.  
  14. if (w.y < 0) w.y += Math.abs(w.y);
  15. if (w.x < 0) w.x += Math.abs(w.x);
  16.            
  17. var screenPixels:BitmapData = effectSprite.framePixels;
  18.            
  19. if (FlxG.renderBlit){
  20.         var copyArea:Rectangle = new Rectangle(w.x, w.y, FlxG.width, FlxG.height);
  21.         effectCam.x = copyArea.x;
  22.         effectCam.y = copyArea.y;
  23.         screenPixels.copyPixels(FlxG.camera.buffer, copyArea, new Point());
  24. }else{
  25.         var copyArea:Rectangle = new Rectangle(0, 0, FlxG.width, FlxG.height);
  26.         screenPixels.draw(FlxG.camera.canvas, null, null, null, copyArea);
  27.         effectCam.x = w.x;
  28.         effectCam.y = w.y;
  29.         effectCam.scroll.x = w.x;
  30.         effectCam.scroll.y = w.y;
  31. }
  32.            
  33. effectCam.color = 0xFF8AFFFF;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement