This is the new topic for the virtual pet me and @codegang are developing, instead of being on the “code emulator challenge win for prize” thread where it really doesn’t fit
just so you know the shop is almost done
here's the link:Snap! Build Your Own Blocks
i can't figure out how to make more pets on the screen do you think you could do that
i've never made a virtual pet but i assume that you could place limbs differently and with a different costume and also give the pet a different walking animation (i don't know how to do that)
I did that already
You linked my version lol, you have to save it as a new project
Try adding the shop current version of the project on my profile, it’s much better than the version I think you got. I made it so if you are dragging the pet it wobbles as if it has velocity, kind of.. it’s really not too accurate
This is the code that does it
But it produces less than ideal results
I’ll try a few things and see if I can get it working how I want
I also added a shop button that scales when you hover over it and rotates toward the mouse’s position (so left and right if the mouse is on its left or right)
I think I found out a way to make it better, this is actually a trigonometry problem!
The sprite, the position the mouse grabbed the sprite on, and the position of the mouse after it moves make a triangle! We are able to use the advanced math blocks to find all the values we need!
The only problem is I haven’t yet learned trigonometry in school because I’m one math grade behind (algebra 2 instead of calculus)
I got word from a friend that you actually learn very basic trigonometry in algebra 2 but I’m not sure. And if I do it will be a while from now
i fixed the link
i can help, i know some trig, i taught myself
what are you trying to calculate?
Basically when you drag the pet arround it should wobble and rotate based on where you grabbed it and where it was on the last frame
Like if you drag it fast to the left it will follow the mouse like it’s being dragged, so facing the opposite direction the mouse is moving, with the center point of rotation being the place the mouse is, then using that to calculate the way it should move
so you want to rotate around a point?
Kind of but not really, I already have roasting arround a point, what we need to do is accurately rotate the sprite as if there was gravity and it being pulled by getting the position of one of the sides of said triangle and inverting it
idk how to do that
How do I get to see the project? it just says that it is unable to fetch it.
You may try this simple script. The sprite rotates around the mouse with the gravity center at, surprisingly , the sprite center. It's based only on the angle, not taking into account mass, speed, acceleration, or momentum, so it's a purely visual effect.
i woudlnt call that simple... but thank you!
It is simple. Most of the script is setting variables.