6.3: Arrays of Objects – p5.js Tutorial

[ad_1]
How can you duplicate a single object and make many of them in an array? This video looks at doing this with “literal” objects, with an eye towards using the constructor function next.

Next video:

Support this channel on Patreon:

Contact:

Send me your questions and coding challenges!:

Link to code on Github:

p5.js:

For More p5.js Videos:

Help us caption & translate this video!


Posted

in

by

Tags:

Comments

41 responses to “6.3: Arrays of Objects – p5.js Tutorial”

  1. Josue Avila Avatar

    that mid-moment crisis in 5:09 lol

  2. seccopower Avatar

    You are the Bob Ross of code!!!

  3. Arash Norouz Avatar

    You are the best coding instructor, keep gold and thanks

  4. john vu Avatar

    watching your videos has increased my attention span its like 12 minutes is 2 !! so interesting keep making these videos!

  5. Karen Burns Avatar

    why did you put the bubble object in function setup()

  6. toonz Avatar

    since your almost always on a green screen i know recognize you the little man who live's in the computer

  7. J.J. Solanki Avatar

    Can I run this in google with file extension HTML?

  8. OrOrg Avatar

    You are self-aware! You know you make the same joke over and over again! 馃榾
    I tolerate it.

  9. Engineer Passion Avatar

    I'm very thankful for this series I like your way of teaching
    I have one question
    why you put "var" before the "i"

    why " for (var i = 0; i < 4; i++) "
    instead of "for ( i = 0; i < 4; i++) "

  10. Will Cavalcanti Avatar

    Thank you for being such a great instructor. I own you A LOT of my programming knowledge.

  11. Rolando Niub贸 Avatar

    i love this dude.. haha lol

  12. Fallen Proximity Avatar

    What editor are you using?

  13. sol0matrix Avatar

    anyone else thing the blue blob reminds you of ghostbusters ? arrays are my weak points in javascript

  14. sol0matrix Avatar

    anyone else thing the blue blob reminds you of ghostbusters ? arrays are my weak points in javascript.

  15. Hiko Avatar

    Same jokes every video, from you;
    Same smile every video, from me.

  16. Bryan Avatar

    Your enthusiasm is contagious. I can tell you love what you do. I only hope to be as good as you one day.

  17. chrononaute Avatar

    why is bubble[i] is defined in the setup function? isn't it supposed to be above the setup function?

  18. BABLU KUMAR Avatar

    Hi Dan, how and why did you call 'println()' method at 5:16 in JavaScript if it does not exist in the p5.js reference? But I remember that print() exists in Javascript and 'println()' in Java.

  19. Zap Z  YT Avatar

    i usually use a vector to store my x,y positions and i mess up with
    this.x and this.pos.x or this.vel.x

  20. Master Paper Avatar

    awesome! will it still work if you use a for loop and push new objects to the array?

  21. KRANTHI KUTTI Avatar

    THERE IS AN ERROR WITH PRINT LINE STATEMENT CAN U HELP ME
    Uncaught ReferenceError: println is not defined (sketch: line 18)

  22. TechNerd01 Avatar

    This script doesn't seem to be working… The print functions are for debugging. Can you help PLEASE!!! I dont know whats wrong. The first time the script goes till "Yep drawing lines :P" but the very moment I use my mouse to draw a line that gets stored in the array… it stops working

    function prevLines(){
    print("Yeah Im here");
    if (activeLine >= 0) {
    print("Yeah more than or equal to 0");
    for (var i = 0 ; i == activeLine ; i++) {
    print("Yep drawing lines :P");
    stroke(255);
    line(lines.x1[i] , lines.y1[i] , lines.x2[i] , lines.y2[i]);
    }
    }
    }

  23. D谩vid Elek Avatar

    very nice tutorial 馃檪 i have a question… what if i want put objects on exactly place by arrays for examples if i want create maze game , how can i do that ?

  24. John Mitchell Avatar

    how come you use Println and not Print?

  25. avinash diwakar Avatar

    your video is easily understandable and the way u explain 馃檪

  26. victoria ordway Avatar

    you are fucking hilarious and a joy to learn from Daniel

  27. imconfusednow Avatar

    I'm getting confused about the difference between an object and a function.

    Maybe they're very different, but they both seem to contain commands and variables that can be called later?
    But then you put a function inside an object, which is called inside a function. They all contain variables, but objects are variables themselves….

    Sorry my username is describing me right now…maybe I watch these videos too late at night >_<.

  28. elementallobster x Avatar

    im trying to add enemies 2 my game and i have too ask you: how do i put my objects in multiple places that i choose? thx.

  29. Dane Filipczak Avatar

    thank you! keep trucking forward, it's much appreciated.

  30. Jose Flores Avatar

    You are a great instructor! Thank you very much for making these videos.

  31. KARTIK JADHAV Avatar

    is 'object' similar to 'class' in processing? .. or is it too early to ask this question 馃槢

  32. Martin Rivera Avatar

    Please DO continue to make more awesome videos!

  33. Ryan Scharfer Avatar

    great video! I am ready for your in-person course ; )

  34. Kurt Strong Avatar

    How do you code the blue blob?

  35. Mesa Lang Avatar

    Daniel 馃榾 You are so lovely!! Thanks for sharing these videossss…. It is fun to learn and see you talking

Leave a Reply

Your email address will not be published. Required fields are marked *