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

#1 2008-07-20 18:21:41

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Pen down on top of _____ block

I can try to make this, but I need a bit of help. Within the sourcecode, what are the existing methods for copying a costume, deleting a costume, determining whether or not a point falls on or in a sprite, and the methods for changing the sprite via paint editor, how it can store the changes and such. What I will do is this: For the "pen down on top of sprite" I will have the current costume of the selected sprite clone itself, allow it to be edited outside of the paint editor, and delete the extra costume when it is done.


All your base are belong to us

Offline

 

#2 2008-07-20 19:00:19

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: Pen down on top of _____ block

Take a look at Jens' Flip. I noticed that it actually points the individual costumes in the opposite direction, so you can end up with some that are flipped and some that aren't. As for all these methods, I'm sure they're in there...but it'll take some time finding them. I'll take a look at the source code to see if I can dig any of them up. (I have no knowledge of Squeak Smalltalk, so it might be best to wait for Jens to come and save us  smile  )

Last edited by fullmoon (2008-07-20 19:00:29)


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#3 2008-07-20 20:20:25

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Re: Pen down on top of _____ block

I already knew that, I just need help finding each specific method. I already spent an hour searching. Jens, help please!

Last edited by Cyclone103 (2008-07-20 20:20:35)


All your base are belong to us

Offline

 

#4 2008-07-20 20:40:49

deatheater
Scratcher
Registered: 2008-04-11
Posts: 1000+

Re: Pen down on top of _____ block

u could have stamping, that way the pen goes over the later stamp which means the pen will be infront  smile

Offline

 

#5 2008-07-20 20:51:42

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Re: Pen down on top of _____ block

deatheater wrote:

u could have stamping, that way the pen goes over the later stamp which means the pen will be infront  smile

Hm, thats true! Although we want to be able to draw on the sprite, and have the sprite be able to move with the pen the same.


All your base are belong to us

Offline

 

#6 2008-07-20 21:42:57

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: Pen down on top of _____ block

We also need "clear my pen" and "clear marks on me" blocks.


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#7 2008-07-20 21:50:05

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: Pen down on top of _____ block

There's something under System Browser>ScratchSpriteMorph>all>instance>touching that (I think) is the method tied to the <touching sprite?> block.

It says:

touching: t1
    | t2 t3 t4 t5 t6 t7 |
    t1 = #mouse
        ifTrue:
            [(t2 _ self ownerThatIsA: ScratchStageMorph) ifNil: [^ false].
            ^ self containsPoint: t2 adjustedCursorPoint].
    t1 = #edge ifTrue: [^ self isOnEdge].
    (t1 isKindOf: self class)
        ifFalse: [^ false].
    (self isHidden not and: [t1 isHidden not])
        ifFalse: [^ false].
    t3 _ self bounds intersect: t1 bounds.
    (t3 width > 0 and: [t3 height > 0])
        ifFalse: [^ false].
    t4 _ Form extent: t3 extent depth: 2.
    t5 _ t4 deepCopy.
    t7 _ self visibility.
    self visibility: 100.
    self drawOn: ((FormCanvas on: t4)
            copyOffset: t3 topLeft negated).
    self visibility: t7.
    t7 _ t1 visibility.
    t1 visibility: 100.
    t1 drawOn: ((FormCanvas on: t5)
            copyOffset: t3 topLeft negated).
    t1 visibility: t7.
    t6 _ Bitmap new: 4 withAll: 1.
    t6 at: 1 put: 0.
    t4
        copyBits: t4 boundingBox
        from: t4
        at: 0 @ 0
        colorMap: t6.
    t5
        copyBits: t5 boundingBox
        from: t5
        at: 0 @ 0
        colorMap: t6.
    t5
        displayOn: t4
        at: 0 @ 0
        rule: Form and.
    ^ (t4 tallyPixelValues at: 1)
        < (t4 width * t4 height)

I have no idea what this means but it may be the method that determines whether a sprite is touching another. Is this anything you're looking for?

Last edited by fullmoon (2008-07-20 21:51:44)


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#8 2008-07-20 21:58:06

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: Pen down on top of _____ block

How about:
Scratch-Objects>ScriptableScratchMorph>media>instance>drawNewCostume

or

Scratch-Objects>ScriptableScratchMorph>media>instance>duplicateMedia?

Last edited by fullmoon (2008-07-20 21:58:34)


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#9 2008-07-21 09:57:36

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Re: Pen down on top of _____ block

fullmoon wrote:

How about:
Scratch-Objects>ScriptableScratchMorph>media>instance>drawNewCostume

or

Scratch-Objects>ScriptableScratchMorph>media>instance>duplicateMedia?

k, the problem with drawNewCostume is that it makes a new one, but it is blank...Ill have to try duplicate media. Although, this would have to be under ScratchSpriteMorph since it would only apply to sprites.


All your base are belong to us

Offline

 

#10 2008-07-21 11:54:22

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Re: Pen down on top of _____ block

Any ideas Jens? I bet u could make this in a snap!


All your base are belong to us

Offline

 

Board footer