P5 simple game Question

I am learning how to animate sprites and one video really helped. But now i am anxious to know how to use the mouse clicked function (i think) to stop the said animation clicked.

While also having the animation change its frame when its clicked(and stopped) so that the character would then be stopped and wearing something different.

also if my spritesheet is saved in the same folder my index.html and sketch.js is and i have no JSON file, how would that look?

simple stuff, i know. but any suggestions/ideas/replies would really help.

i would do something like this. this is just a basic example and may not be the best way to do it in p5 i’m just more used to js so allow for some translation errors

awh its so cute! it is pretty close! im curious. i have this sprite sheet. and i

and i think creating my own JSON file would be super helpful but i dont know how. ive looked up some options. to no avail.

I think it would make it easier to command certain frame when my little guy is clicked.

i was thinking of having multiple sprite animations moving from one end of the screen to the other. then when i click one it “dies”(ceases movement and looks like a dead cyclops/monster)

harder than it seems for a newbie :slight_smile:

thank youuuu. your sure ant art looks pretty amazing

i was thinking of having multiple sprite animations moving from one end of the screen to the other. then when i click one it “dies”(ceases movement and looks like a dead cyclops/monster)

harder than it seems for a newbie :slight_smile:

the art isn’t mine and i couldn’t tell you where i got it. it’s a sprite of link from minish cap i believe, just something to show how animations might work. as for multiple sprites you could just wrap what i’ve shown in a “class” and just pass each sprite to each instance of the “class” as well as giving each one their own framerates etc you can give them a position and move them according to that. best of luck with it all.

1 Like