This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2009-01-08 12:35:52

erbie
Scratcher
Registered: 2008-12-26
Posts: 12

new block request: "attach to sprite"

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

 

#2 2009-01-08 20:10:23

Buddy_ca111
Scratcher
Registered: 2008-08-30
Posts: 100+

Re: new block request: "attach to sprite"

Like for a car if the body hit a wall the wheels would stop too?


By reading this you agree to giving me your soul, money, passwords, projects, abiltys and your bases

Offline

 

#3 2009-01-08 21:48:37

erbie
Scratcher
Registered: 2008-12-26
Posts: 12

Re: new block request: "attach to sprite"

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

 

#4 2009-12-21 04:23:39

Jesscookie
Scratcher
Registered: 2008-02-08
Posts: 100+

Re: new block request: "attach to sprite"

Isn't that kind of like this block?
<go to[

Last edited by Jesscookie (2009-12-21 04:25:07)


http://i172.photobucket.com/albums/w23/Fresh-Mikey/1995_gif_280x210.gif

Offline

 

#5 2009-12-21 04:29:04

WeirdF
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: new block request: "attach to sprite"

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)


http://i.cr3ation.co.uk/dl/s1/gif/847032b8a331def77529b6a0384db1fe_handfingers.gif

Offline

 

#6 2009-12-21 22:22:29

SnowGuy
Scratcher
Registered: 2008-11-25
Posts: 41

Re: new block request: "attach to sprite"

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....


This account is dead. See my new one here.

Offline

 

#7 2009-12-22 15:17:27

jacool
Scratcher
Registered: 2008-01-25
Posts: 1000+

Re: new block request: "attach to sprite"

Maybe there should be a local and a global positioning mode.
For instance:

Go to local position X: [ ] Y: [ ] of sprite1


http://i571.photobucket.com/albums/ss159/JacobKar/svensktiger-1.png

Offline

 

#8 2009-12-22 15:33:40

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: new block request: "attach to sprite"

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  sad  Good luck though.


http://i.imgur.com/WBkM2QQ.png

Offline

 

#9 2009-12-22 15:36:22

cocoanut
Scratcher
Registered: 2007-07-10
Posts: 1000+

Re: new block request: "attach to sprite"

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.


http://i42.tinypic.com/20gyvif.jpgPlease leave a message at the beep.
Steam: Hellephant

Offline

 

#10 2009-12-26 04:32:04

scoreman
Scratcher
Registered: 2009-10-03
Posts: 14

Re: new block request: "attach to sprite"

<wait(<abs( <{  }>  )secsc>

Offline

 

Board footer