Some code from ES6 JavaScript
ackvonhuelioLvl 41
- iPhone
Yor mom?
- Windows
Letti42 And what about this
addEventListener('mouseup', (event) => {mouse.holding = false})
addEventListener('mouseup', (event) => {mouse.holding = true})
- Windows
Letti42 Tbh code.org's programming system isnt even ES5, it's something less than that . . .
- Windows
person You just read some constructor code. ES6 is ES5 javascript but with some updates (read more here (https://www.w3schools.com/js/js_es6.asp))
Also there's ES7, 8, 9 and 10, but with only a small update
You don't 'FIND' the newer versions, your browser should already support them. The way newer versions might not be compatible for all browsers thoug (es7, 8, 9, 10, you'd have to do your own reasearch).
If you're using cdo, they're never gonna update it, so if you want to
get there
you can just download your own code editor (i recommend sublime text cause u can auto save)
personLvl 62
ok ima take a wild guess, Gerald van baron the second
Letti42Lvl 6
- Windows
ASmartCoder dawg didn't even read my reply‼️‼️😂🥶🥶💯
addEventListener('mouseup', (event) => {mouse.holding = false})
addEventListener('mouseup', (event) => {mouse.holding = true})
->>
addEventListener('mouseup', () => mouse.holding = false);
addEventListener('mouseup', () => mouse.holding = true);
if you want to make it even shorter:
.onmouseup = ()=> mouse.holding = false;
also 2 onmouseup events? or are they for different elements
Letti42Lvl 6
- Windows
Though I am wondering.. are you still using a p5 library? If you are then there isn't much different from code.org's es5, other than a bit more freedom with some functions... it all still does the same thing
- Windows
Letti42 mb there was supposed to be mouseup and mousedown
- Windows
Letti42 Not really
sprites have a limited amount of things that you can actually implement on.
For example, the main properites of sprites that we all know is x, y, width, height, rotation. But you're limited in a way. Cdo pre-built the constructor, the canvas, and some other things, and making your own class is forbidden (class for sprites)
ackvonhuelioLvl 41
Letti42
calling someone a dog is dehumanizing.
morons like you keep pulling our society down.
ackvonhuelioLvl 41
ASmartCoder
a sprite is just a constructor, so you can(actually I did once) add a bunch of properties and then define your own usages for those properties
for example,:
// made a new sprite function cuz i don't wanna go through CDO code and find what the actual sprite constructor is called in order to make a prototype function thingy
function makeySprite(x,y){
this.sprite = createSprite(x,y);
this.sprite.dog = 0;
}
makeySprite.prototype.dehumanize = function(){
this.sprite.dog += 1;
};
var sprite = new makeySprite(200,200);
sprite.dehumanize();
personLvl 62
technically thats just calling them a furry
Letti42Lvl 6
- Windows
ackvonhuelio yo please tell me your joking 😂😂 aint no way mans think I called him an actual dog
- Android
ackvonhuelio ur still using createsprite, which is part of cdo
ackvonhuelioLvl 41
ASmartCoder
...um...
ok...?
point is, sprites, being constructors, can be given more properties
VarrienceLvl 25
- Edited
ASmartCoder well thing is you can extend the constructor of createSprite but you kinda have to fuck wit it to get what you want ackvonhuelio has spared your eyes you should be grateful lmao also createSprite should just be an extension of the Sprite() class since it's based off p5.play
ackvonhuelioLvl 41
Varrience
why do they teach people to use createSprite()
instead of new Sprite()
???
seems like its kinda unnecessary, gets rid of a possible introduction to constructors, and creates a pain for people like me who want to extend the Sprite() constructor
VarrienceLvl 25
ackvonhuelio true... i assume it's to get people started with functions maybe? constructors may be a bit much to show someone when there just starting out as well but that's definitely something they probably should incorporate especially since there starting java lab which basically relies off of object to get anything running
Letti42Lvl 6
- Edited
- Windows
ackvonhuelio The point of Gamelab is too be able to be taught to students (little gross kids) who are probably 8 year olds. It may introduce them to constructors early on, but think about it - is it easier to teach a kid, "oh, just use this function!", or to instead have a whole lesson on how constructors work? Gamelab is a tool for teaching, and presenting the kids with a completely new concept is way too hard for both code.org and the teachers..