Results 1 to 9 of 9

Thread: Happy Beaver!

  1. #1
    Banned
    Join Date
    Feb 2015
    Posts
    545

    Starter Pistol Happy Beaver!

    I Sorta made something

    var Beaver = function(x, y) {
    this.x = x;
    this.y = y;
    this.img = getImage("creatures/Hopper-Happy");
    this.sticks = 0;
    };

    Beaver.prototype.draw = function() {
    fill(255, 0, 0);
    this.y = constrain(this.y, 0, height-50);
    image(this.img, this.x, this.y, 40, 40);
    };

    Beaver.prototype.hop = function() {
    this.img = getImage("creatures/Hopper-Jumping");
    this.y -= 5;
    };

    Beaver.prototype.fall = function() {
    this.img = getImage("creatures/Hopper-Happy");
    this.y += 5;
    };

    Beaver.prototype.checkForStickGrab = function(stick) {
    if ((stick.x >= this.x && stick.x <= (this.x + 40)) &&
    (stick.y >= this.y && stick.y <= (this.y + 40))) {
    stick.y = -400;
    this.sticks++;
    }
    };

    var Stick = function(x, y) {
    this.x = x;
    this.y = y;
    };

    Stick.prototype.draw = function() {
    fill(89, 71, 0);
    rectMode(CENTER);
    rect(this.x, this.y, 5, 40);
    };

    var beaver = new Beaver(200, 300);

    var sticks = [];
    for (var i = 0; i < 40; i++) {
    sticks.push(new Stick(i * 40 + 300, random(20, 260)));
    }

    var grassXs = [];
    for (var i = 0; i < 25; i++) {
    grassXs.push(i*20);
    }

    draw = function() {

    // static
    background(227, 254, 255);
    fill(130, 79, 43);
    rectMode(CORNER);
    rect(0, height*0.90, width, height*0.10);

    for (var i = 0; i < grassXs.length; i++) {
    image(getImage("cute/GrassBlock"), grassXs[i], height*0.85, 20, 20);
    grassXs[i] -= 1;
    if (grassXs[i] <= -20) {
    grassXs[i] = width;
    }
    }

    for (var i = 0; i < sticks.length; i++) {
    sticks[i].draw();
    beaver.checkForStickGrab(sticks[i]);
    sticks[i].x -= 1;
    }

    textSize(18);
    text("Score: " + beaver.sticks, 20, 30);

    if (beaver.sticks/sticks.length >= 0.95) {
    textSize(36);
    text("YOU WIN!!!!", 100, 200);
    }

    if (keyIsPressed && keyCode === 0) {
    beaver.hop();
    } else {
    beaver.fall();
    }
    beaver.draw();
    };

  2. #2
    Big Cheese Captain
    Join Date
    Jun 2013
    Posts
    1,029
    Quote Originally Posted by KnS View Post
    I Sorta made something

    var Beaver = function(x, y) {
    this.x = x;
    this.y = y;
    this.img = getImage("creatures/Hopper-Happy");
    this.sticks = 0;
    };

    Beaver.prototype.draw = function() {
    fill(255, 0, 0);
    this.y = constrain(this.y, 0, height-50);
    image(this.img, this.x, this.y, 40, 40);
    };

    Beaver.prototype.hop = function() {
    this.img = getImage("creatures/Hopper-Jumping");
    this.y -= 5;
    };

    Beaver.prototype.fall = function() {
    this.img = getImage("creatures/Hopper-Happy");
    this.y += 5;
    };

    Beaver.prototype.checkForStickGrab = function(stick) {
    if ((stick.x >= this.x && stick.x <= (this.x + 40)) &&
    (stick.y >= this.y && stick.y <= (this.y + 40))) {
    stick.y = -400;
    this.sticks++;
    }
    };

    var Stick = function(x, y) {
    this.x = x;
    this.y = y;
    };

    Stick.prototype.draw = function() {
    fill(89, 71, 0);
    rectMode(CENTER);
    rect(this.x, this.y, 5, 40);
    };

    var beaver = new Beaver(200, 300);

    var sticks = [];
    for (var i = 0; i < 40; i++) {
    sticks.push(new Stick(i * 40 + 300, random(20, 260)));
    }

    var grassXs = [];
    for (var i = 0; i < 25; i++) {
    grassXs.push(i*20);
    }

    draw = function() {

    // static
    background(227, 254, 255);
    fill(130, 79, 43);
    rectMode(CORNER);
    rect(0, height*0.90, width, height*0.10);

    for (var i = 0; i < grassXs.length; i++) {
    image(getImage("cute/GrassBlock"), grassXs[i], height*0.85, 20, 20);
    grassXs[i] -= 1;
    if (grassXs[i] <= -20) {
    grassXs[i] = width;
    }
    }

    for (var i = 0; i < sticks.length; i++) {
    sticks[i].draw();
    beaver.checkForStickGrab(sticks[i]);
    sticks[i].x -= 1;
    }

    textSize(18);
    text("Score: " + beaver.sticks, 20, 30);

    if (beaver.sticks/sticks.length >= 0.95) {
    textSize(36);
    text("YOU WIN!!!!", 100, 200);
    }

    if (keyIsPressed && keyCode === 0) {
    beaver.hop();
    } else {
    beaver.fall();
    }
    beaver.draw();
    };
    You did not make this...do you even know what language this is programmed in?
    iEra Developer / SFX Admin

    Need help? Contact me:
    Email: [email protected]

  3. #3
    Street Boss Cero's Avatar
    Join Date
    Aug 2014
    Location
    Complex
    Posts
    875
    Caught again....
    http://maidendarkness.deviantart.com/art/Gin-Ichimaru-Signature-283794110
    Kamishini no yari

  4. #4
    Banned
    Join Date
    Feb 2015
    Posts
    545
    :? caught how?

    - - - Updated - - -

    i made this on khan academy. in my digital media class.

  5. #5
    Big Cheese Captain
    Join Date
    Jun 2013
    Posts
    1,029
    Quote Originally Posted by KnS View Post
    :? caught how?

    - - - Updated - - -

    i made this on khan academy. in my digital media class.
    No you didn't, you copy pasted

    https://ideone.com/fork/iOnrvT
    iEra Developer / SFX Admin

    Need help? Contact me:
    Email: [email protected]

  6. #6
    Banned
    Join Date
    Feb 2015
    Posts
    545
    actually i did make it on khan academy. i don't even have that site on my history. Idiot.

    - - - Updated - - -

    Screen Shot 2015-03-13 at 2.35.22 PM.png

    Don't you feel stupid.

    - - - Updated - - -

    Screen Shot 2015-03-13 at 2.35.22 PM.png

    Don't you feel stupid.

    Screen Shot 2015-03-13 at 2.37.32 PM.jpg

    You Feel Stupider Now

    Screen Shot 2015-03-13 at 2.38.10 PM.png

    Your IQ is Now 0

  7. #7
    Big Cheese Captain
    Join Date
    Jun 2013
    Posts
    1,029
    Quote Originally Posted by KnS View Post
    actually i did make it on khan academy. i don't even have that site on my history. Idiot.

    - - - Updated - - -

    Screen Shot 2015-03-13 at 2.35.22 PM.png

    Don't you feel stupid.

    - - - Updated - - -

    Screen Shot 2015-03-13 at 2.35.22 PM.png

    Don't you feel stupid.

    Screen Shot 2015-03-13 at 2.37.32 PM.jpg

    You Feel Stupider Now

    Screen Shot 2015-03-13 at 2.38.10 PM.png

    Your IQ is Now 0
    Showing your history proves nothing . Copy and pasting it from the site in my previous reply and pasting it on khan academy takes no skill

    Could you explain why your code and the code used in the link I mentionned in the previous reply are IDENTICAL?

    First you stole customs, now you're stealing scripts. You're fooling NOBODY.

    If you're going to steal, get out. Point being is that I see your other threads. You're the type of person that takes other peoples work and claims them as your own.

    Requesting this thread to be closed.
    Last edited by iMask; 03-13-2015 at 07:57 PM.
    iEra Developer / SFX Admin

    Need help? Contact me:
    Email: [email protected]

  8. #8
    Player Relations Admin Ace's Avatar
    Join Date
    Jul 2013
    Location
    Canada
    Posts
    6,226
    I don't like where this is going
    Global Moderator Feb 21, 2014 - Oct 10, 2014 (8 months)
    iEra Player Relations April 10, 2014 - Oct 10, 2014 (6 months)
    iEra Communications Support Oct 10, 2014 - Feb 9, 2015 (4 months)
    Ol West Communications Admin Nov 15, 2014 - Resigned (9 months)
    iEra Communications Admin Feb 9, 2015 - April 10, 2016 (15 months)
    iEra Player Relations Admin April 10, 2016 - Current
    Retired from Toonslab Support
    Toonslab FAQ [email protected]

  9. #9
    Banned
    Join Date
    Jun 2013
    Location
    Melbourne
    Posts
    1,914
    You realise we can't use all these games you post the code for?
    We use a specialised scripting language called GS2

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •