forked from: Kong-Sucking Ass

by raa
♥0 | Line 174 | Modified 2016-01-10 08:00:33 | MIT License
play

ActionScript3 source code

/**
 * Copyright raa ( http://wonderfl.net/user/raa )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/6YVu
 */

// forked from Bletraut's Kong-Sucking Ass
// Hi, my name is Bletraut.
// This is Kong-Game which suck my ass, cuz it's very shit.
// If you want to say me 'Your game SUCK ASS!!!' or 'Dude it's amazing I wanna to suck your dick', 
// than my skype 'Bletraut' XD
// I'm kidding guys! XD


package 
{
    import flash.text.TextField;
    import flash.geom.Vector3D;
    import flash.display.AVM1Movie;
    import flash.display.Sprite;
    import flash.events.Event;
    
    public class FlashTest extends Sprite 
    {
        // Bla bla bla
        public var score:Number = 0;
        public var scorePanel:TextField;
        public var blockArr:Array = new Array();
        public var blockSpawn:Vector3D = new Vector3D(100, 100, 5, 5);
        
        // Display porno
        public var player:Sprite;
        public var ball:GameBall;
        
        public function FlashTest() 
        {
            //Init
            gameInit();
            
            this.addEventListener(Event.ENTER_FRAME, update);
        }
        
        private function update(e:Event):void
        {
            ball.x += ball.xspeed;
            ball.y += ball.yspeed;
            
            player.x = stage.mouseX;
            
            scorePanel.text = "Score: " + score;
            
            collisionDetected();
        }
        
        // I can fuck you
        private function collisionDetected():void
        {
            // Little bitch and fag
            if (ball.x > player.x && ball.x < player.x + player.width 
               && ball.y + ball.height > player.y && ball.y < player.y + player.height)
            {
                ball.y = player.y - ball.height;
                ball.yspeed *= -1;
            }
            
            // Little bitch and walls
            if (ball.x > stage.stageWidth)
            {
                ball.x = stage.stageWidth - ball.width;
                ball.xspeed *= -1;
            }
            if (ball.x < 0)
            {
                ball.x = 0;
                ball.xspeed *= -1;
            }
            if (ball.y < 0)
            {
                ball.y = 0;
                ball.yspeed *= -1;
            }
            
            // Oeeeeah
            if(ball.y > 500)
            {
                score = 0;
                restartGame();
            }
              
            if(blockArr.length == 0)
            {
                ball.xspeed = ball.yspeed += 2;
                restartGame();
            }
            
            // Little bitch and motherfuckers
            var i:int = blockArr.length;
            while(i--)
            {
                var j:GameBlock = blockArr[i];
                
                // bla bla bla, x
                if (ball.y + ball.height > j.y && ball.y < j.y + j.height)
                {
                    // right
                    if( ball.x + ball.width + ball.xspeed > j.x && ball.x < j.x)
                    {
                        ball.x = j.x - ball.width;
                        ball.xspeed *= -1;
                        
                        score += 10;
                        blockArr.splice(i,1);
                        j.parent.removeChild(j);
                        break;
                    }
                    // left
                    if (ball.x + ball.xspeed < j.x + j.width && ball.x > j.x)
                    {
                        ball.x = j.x + j.width;
                        ball.xspeed *= -1;
                        
                        score += 10;
                        blockArr.splice(i,1);
                        j.parent.removeChild(j);
                        break;
                    }
                }
                // bla bla bla, y
                else if (ball.x + ball.width > j.x && ball.x < j.x + j.width)
                {
                    // up
                    if (ball.y + ball.height + ball.yspeed > j.y && ball.y < j.y)
                    {
                        ball.y = j.y - ball.height;
                        ball.yspeed *= -1;
                        
                        score += 10;
                        blockArr.splice(i,1);
                        j.parent.removeChild(j);
                        break;
                    }
                    // down
                    if (ball.y + ball.yspeed < j.y + j.height && ball.y > j.y)
                    {
                        ball.y = j.y + j.height;
                        ball.yspeed *= -1;
                        
                        score += 10;
                        blockArr.splice(i,1);
                        j.parent.removeChild(j);
                        break;
                    }
                }
            }
        }
        
        // Restart!!!!!!
        private function restartGame():void
        {
            blockArr = [];
            
            var i:int = this.numChildren;
            while(i--)
            {
                this.removeChildAt(i);
            }
            
            gameInit();
        }
        /////////////////////////////////////

        // Init go fuck yourself
        private function gameInit():void
        {
            scorePanel = new TextField();
            this.addChild(scorePanel);
            
            // Fag
            player = new Sprite();
            player.x = 200;
            player.y = 400;
            player.graphics.beginFill(0xAF00F0);
            player.graphics.drawRect(0,0,150,20);
            this.addChild(player);
            
            // Little bitch
            ball = new GameBall();
            ball.x = 250;
            ball.y = 380;
            this.addChild(ball);
            
            // Motherfuckers
            generateMap();
        }
        
        // Create motherfuckers!!!
        private function generateMap(r:int = 5, c:int = 5):void
        {
            for(var i:int = 0; i < r; i++)
            {
                for(var j:int = 0; j < c; j++)
                {
                    var block:GameBlock = new GameBlock();
                    block.x = blockSpawn.x + block.width*j + blockSpawn.z*j;
                    block.y = blockSpawn.y + block.height*i + blockSpawn.w*i;
                    blockArr.push(block);
                    this.addChild(block);
                }

            }

        }

    }
}

// Other boolshit
import flash.display.Sprite;

// Ball
class GameBall extends Sprite
{
    public var xspeed:Number = 5;
    public var yspeed:Number = 5;
    
    public function GameBall()
    {
        this.graphics.beginFill(0x000000);
        this.graphics.drawCircle(0,0,5);
    }

}


// Block
class GameBlock extends Sprite
{
    public var color:uint = 0x00FF00;
    public var life:int = 1;
    
    public function GameBlock(_color:uint = 0x00FF00, _life:int = 0)
    {
        color = _color;
        life = _life;
        
        this.graphics.beginFill(_color);
        this.graphics.drawRect(0,0,50,25);
    }

}