Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stop();
- var speed:Number = 2;
- var grip:int = 100;
- var spaceBol:Boolean = false;
- var spaceTimer:int = 8;
- var gripLoss:int = 2;
- var lossTimer:int = 20-speed
- var onBull:Boolean = true;
- var score:int = 0;
- var multi:int = 1;
- var bestMulti:int = 0;
- var gameOverTimer:int = -1;
- var kDown:Boolean = false;;
- var markTarg:Number;
- var smash:pSmash1 = new pSmash1();
- stage.addEventListener(Event.ENTER_FRAME,eFrame)
- stage.addEventListener(KeyboardEvent.KEY_DOWN, keysDown);
- stage.addEventListener(KeyboardEvent.KEY_UP, keysUp);
- function keysDown(event:KeyboardEvent):void {
- if (event.keyCode == Keyboard.SPACE) {
- spaceBol = true;
- }
- }
- function keysUp(event:KeyboardEvent):void {
- if (event.keyCode == Keyboard.SPACE) {
- spaceBol = false;
- kDown = false;
- }
- }
- function eFrame(e:Event){
- multiTxt.text = "Multiplier : "+ multi.toString();
- scoreTxt.text = "Score : "+ score.toString();
- speedo.gotoAndStop(Math.round(speed*10))
- markTarg = (351 - (grip*3))
- if(marker.y < markTarg && onBull){
- marker.y += (marker.y / markTarg)
- }
- else if(marker.y > markTarg && onBull){
- marker.y -= (marker.y / markTarg)
- }
- if(spaceTimer > 0 && onBull){
- spaceTimer --
- }
- if(lossTimer > 0 && onBull){
- lossTimer --
- if(lossTimer <= 0 && onBull){
- grip -= gripLoss
- lossTimer = 20-speed
- }
- }
- if(spaceBol && spaceTimer == 0 && !kDown){
- kDown = true;
- if(dot.rotation > -10 && dot.rotation < 10){
- grip += gripLoss * 5
- score += 25
- multi ++
- }
- else if(dot.rotation > -20 && dot.rotation < 20){
- grip += gripLoss * 3
- score += 10
- multi ++
- }
- else if(dot.rotation > -45 && dot.rotation < 45){
- grip += gripLoss * 1
- score += 5
- multi ++
- }
- else if(dot.rotation > -70 && dot.rotation < 70){
- grip += gripLoss * 0.8
- }
- else if(dot.rotation > 70 || dot.rotation < -70){
- grip -= gripLoss
- multi = 1
- }
- if(grip > 100){
- grip = 100
- }
- if(multi > bestMulti){
- bestMulti = multi
- }
- spaceTimer = 8
- }
- bullMC.rotation += speed
- if(speed < 10 && grip > 0){
- speed *= 1.001
- }
- if(speed > 10){
- speed = 10
- }
- if(grip > 0 && onBull){
- dot.rotation += 1.8 * speed
- rider.rotation += speed
- score += (1*multi)
- }
- if(grip <= 0){
- speed *= 0.99
- if(onBull){
- rider.gotoAndPlay("thrown")
- bullMC.gotoAndStop(1)
- onBull = false;
- gameOverTimer = 45;
- }
- if(!onBull && gameOverTimer > 0){
- gameOverTimer--
- if(gameOverTimer == 0){
- stage.removeEventListener(Event.ENTER_FRAME,eFrame)
- stage.removeEventListener(KeyboardEvent.KEY_DOWN, keysDown);
- stage.removeEventListener(KeyboardEvent.KEY_UP, keysUp);
- nextFrame();
- }
- }
- }
- if(speed < 1){
- speed = 0
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement