Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //These two functions spawn a psudo-random vertical set of blocks.
- //There are two kinds of blocks, one which the player can shoot to pass through
- //and "spike blocks" which can't be shot. The first function sets up two spans of breakable
- //blocks for the player to try to shoot, and the 2nd one spawns just one span of breakables
- //surrounded by spikes. Each column has exactly 14 blocks in them.
- public function setupBlocksBetter2():void
- {
- //spikeblock, then span of breakables, then 1 - 3 spikes, then breakables until the 2nd to last one, which is a spike
- var rand:Number;
- var i:int;
- var blockcount:int = 1; //keep track of how many blocks we've spawned
- i = 1;
- _blocks.add(new block(Rsp, i * 15, globalSpeed)); //add top spike block
- _spikeBlocks.add(new spikeblock(Rsp - 1, i * 15 + 3, globalSpeed));
- blockcount ++;
- rand = FlxU.random() * 6; //random number between 1 and 6
- rand += 2; //add buffer in the event it's zero
- for (i = 2; i <= rand; i++) //spwan those breakables
- {
- _breakBlocks.add(new blockBreakable(Rsp, i * 15, _littleGibs, globalSpeed));
- blockcount ++;
- }
- rand = FlxU.random() * 2;
- rand += (blockcount + 1);
- for (blockcount; blockcount <= rand; blockcount++)
- {
- _blocks.add(new block(Rsp, blockcount * 15, globalSpeed));
- _spikeBlocks.add(new spikeblock(Rsp - 1, blockcount * 15 + 3, globalSpeed));
- // blockcount ++;
- }
- for (blockcount; blockcount <= 13; blockcount++)
- {
- _breakBlocks.add(new blockBreakable(Rsp, blockcount * 15, _littleGibs, globalSpeed));
- }
- _blocks.add(new block(Rsp, 14 * 15, globalSpeed));
- _spikeBlocks.add(new spikeblock(Rsp - 1, 14 * 15 + 3, globalSpeed));
- }
- public function setupBlocksBetter3():void
- {
- //instead of 2 spans of breakables, just one in the center
- var rand:Number;
- var i:int;
- var blockcount:int = 1; //keep track of how many blocks we've spawned
- i = 1;
- _blocks.add(new block(Rsp, i * 15, globalSpeed)); //add top spike block
- _spikeBlocks.add(new spikeblock(Rsp - 1, i * 15 + 3, globalSpeed));
- blockcount ++;
- rand = FlxU.random() * 4; //random number between 1 and 4
- rand += 1; //add buffer in the event it's zero
- for (i = 2; i <= rand; i++) //spwan those spikes
- {
- _blocks.add(new block(Rsp, blockcount * 15, globalSpeed));
- _spikeBlocks.add(new spikeblock(Rsp - 1, blockcount * 15 + 3, globalSpeed));
- blockcount ++;
- }
- rand = FlxU.random() * 6;
- rand += (blockcount + 2);
- for (blockcount; blockcount <= rand; blockcount++)
- {
- _breakBlocks.add(new blockBreakable(Rsp, blockcount * 15, _littleGibs, globalSpeed));
- // blockcount ++;
- //middle section
- }
- for (blockcount; blockcount <= 13; blockcount++)
- {
- _blocks.add(new block(Rsp, blockcount * 15, globalSpeed));
- _spikeBlocks.add(new spikeblock(Rsp - 1, blockcount * 15 + 3, globalSpeed));
- }
- _blocks.add(new block(Rsp, 14 * 15, globalSpeed));
- _spikeBlocks.add(new spikeblock(Rsp - 1, 14 * 15 + 3, globalSpeed));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement