In my "skeleton poser" project, it took a lot of work (and math) to make the body parts attach to each other. And the result is not ideal - it's hard to edit the attach points and there's a lag between when the body is dragged or animated and when the attached limbs are updated.
I would like to propose a new "attach to sprite" block. This block would anchor the current sprite to a specified sprite at the current sprite's location. Once attached, the sprite's x,y, and direction would become relative to the attached-to sprite. There should obviously be a "detach" block as well.
With this new block, you could create all kinds of hierarchical animation:
- you could attach spinning wheels to a car that automatically move with the car
- you could attach eyes and mouth to a face
- you could make a moon that orbits a planet which orbits a star
- you could implement a platform game where a character can jump onto a moving platform and then move with it
- and so on...
Note: attachment just means the attached sprite's location is now in the local coordinate system of the parent sprite. This shouldn't prevent the attached sprite from being moved or dragged; it should just move relative to the parent. For instance, if you jiggle y up and down on a car tire, it should move up and down relative to the car (like a car suspension) even if the car is rotated as if climbing a hill.
Oh, and if you change the size of the parent sprite, the coordinate system should scale to preserve the attachment, and the attached sprites should scale too. E.g. if you scale the car, the wheels should scale.
Offline
Like for a car if the body hit a wall the wheels would stop too?
Offline
Buddy_ca111 wrote:
Like for a car if the body hit a wall the wheels would stop too?
Right. If you attach the wheels to the car, the wheels would move wherever the car moved. If you stopped moving the car, the wheels would stop. Basically, the wheels would act like they were part of the car sprite except that you could rotate them.
Offline
Isn't that kind of like this block?
<go to[
Last edited by Jesscookie (2009-12-21 04:25:07)
Offline
Jesscookie wrote:
Isn't that kind of like this block?
[blocks]<go to[[/blocks]
That gives it exactly the same coordinates as the other sprite.
____________________________________________________________________________________
There is an way round this.
Just do this:
Go to x (x position of sprite 2) - [?]) y (y position of sprite 2) - [?])
Just replace the question marks with how much you want to add or take away, and it will stay in that position in relation to the sprite.
Last edited by WeirdF (2009-12-21 04:30:02)
Offline
WeirdF wrote:
Jesscookie wrote:
Isn't that kind of like this block?
[blocks]<go to[[/blocks]That gives it exactly the same coordinates as the other sprite.
____________________________________________________________________________________
There is an way round this.
Just do this:
Go to x (x position of sprite 2) - [?]) y (y position of sprite 2) - [?])
Just replace the question marks with how much you want to add or take away, and it will stay in that position in relation to the sprite.
Lot's of times people ask for things and are told no, it would make it to complicated. Well that block would make it a lot less complicated....
Offline
Try BYOB. Theres a stickied topic about it in the advanced topics forums. There are 'nestable sprites', which basically attach to the sprite. But after downloading, look at the example projects, and 2 of them are engine projects, showing the engines work, and two methods for doing it, and you can base it from that. The only problem is that then you can't upload to the scratch website Good luck though.
Offline
jacool wrote:
Maybe there should be a local and a global positioning mode.
For instance:
Go to local position X: [ ] Y: [ ] of sprite1
Yeah, like offset.
Offline