A downloadable resource

P5play

P5play is a P5.js library developed originally by Paolo Pedercini that makes it easier to make games. Version 3 is led by Quinton Ashley.

P5.js, which we looked at in class, will still be useful for a few things. But mostly we'll be using P5play for the game stuff.

This library will help you handle sprites and animation, groups of objects, collisions, and simple physics, 

Getting Started Resources

With p5play and OpenProcessing you can build games!

Enabling P5play in your Projects


If you get an error It seems that you may have accidentally written "Canvas" instead of "noCanvas" you forgot to toggle P5play on.

Quick Reference

Sprites Reference

Group Reference

Input (Mouse and Keyboard)

  • Mouse and Keyboard basics
    • Presses = as soon as the mouse/kb button is pressed
    • Pressing = holding down the button
    • Holding = the count of how many frames it's been down
    • Released = when the button comes back up

Comparisons and Operators

descriptioncodeexample
is equal to==if ( game_over == true ) {
 showHighScore()
}
is not equal to!=if ( has_power_up != true ) {
  gainThePowerUp()
}
greater than>if ( missile.pos.x > 600 ) {
 missile.remove() 
}
less than<if ( countdown_timer < 0 ) {
  resetTheLevel() 
}
greater than or equal>=if ( score >= 50) {
  giveExtraLife()
}
less than or equal<=if ( enemies.length <= 0 ) {
  moveToNextLevel() 
}
"and"&&if ( raining == true && outside == true ) {
 console.log("Bring an umbrella")
}
"or"||if ( holiday == "halloween" || holiday == "valentines" ) { buyCandy()
}

Download

Download
Including P5Play.2020-02-19 16_04_43.gif 653 kB