11 Replies Latest reply on Jun 6, 2007 9:42 AM by Newsgroup_User

Place sprite on stage using Lingo

I searching 2 days now for what i think is a simple problem.

I have an array:
worldGrid = [ 0, 1, 0, 1, 0, 1]

Now i want to place a sprite for each index in the array:

repeat with i = 0 to worldGrid.count()
( add a sprite to the stage on location x,y)
put "place tile"i,"@",x,y
x = 20 + x
end repeat

But i cant find anywhere how to put a sprite on the stage. So can anyone help me encode the second line in the repeat?
• 1. Re: Place sprite on stage using Lingo

Hi Martijn,

to place a sprite in an empty channel, use the puppetSprite property:

sprite(i).puppet = true

then you can treat it like any other sprite:

sprite(i).loc = point(x, y)

Watch out with the loop starting at 0. Lists in Lingo are 1-based. ie:
the first item is at position 1 instead of 0.

hth,
Manno

martijntijn wrote:
> I searching 2 days now for what i think is a simple problem.
>
> I have an array:
> worldGrid = [ 0, 1, 0, 1, 0, 1]
>
> Now i want to place a sprite for each index in the array:
>
> repeat with i = 0 to worldGrid.count()
> ( add a sprite to the stage on location x,y)
> put "place tile"i,"@",x,y
> x = 20 + x
> end repeat
>

>
> But i cant find anywhere how to put a sprite on the stage. So can anyone help
> me encode the second line in the repeat?
>

--
----------
Manno Bult
http://www.aloft.nl
• 2. Re: Place sprite on stage using Lingo

sprite(i).puppet = true

#puppet

what does this say?

• 3. Re: Place sprite on stage using Lingo

Are you sure you're not still looping from 0? there is no sprite(0) to
set the puppet property of so you get the property not found error. (I
forgot the number of the scriptchannel. Thought it was some negative
value, not sure)

the MX2004 lingo would by the way be:
_movie.puppetSprite(i, true)

puppet sets the sprite fully under Lingo control just like puppetTempo
sets the framerate with lingo.

suppose you have an empty score (just a frameloop script in the
scriptchannel and a bitmap member called "test") and type the folowing
in the messagewindow while the movie plays:

sprite(1).puppet = true
sprite(1).member = member("test") -- it should appear at point(0, 0)
sprite(1).loc = point(100, 100)

Don't forget to 'unpuppet' the sprites once you leave the frame/screen
they are in. setting the puppet of a sprite to true overrules all score
based placement of sprites.

hth,
Manno

martijntijn wrote:
> sprite(i).puppet = true
>
> #puppet
>
> what does this say?
>
>

--
----------
Manno Bult
http://www.aloft.nl
• 4. Re: Place sprite on stage using Lingo
Thanx, now it works :D
• 5. Re: Place sprite on stage using Lingo
martijntijn wrote:
> Thanx, now it works :D

you're welcome!

--
----------
Manno Bult
http://www.aloft.nl
• 6. Re: Place sprite on stage using Lingo
You should be using makeScriptedSprite() instead of puppet... puppeting has
been pretty much defunct since version 6.

--
Dave -
http://www.blurredistinction.com

• 7. Re: Place sprite on stage using Lingo
> You should be using makeScriptedSprite() instead of puppet... puppeting has
> been pretty much defunct since version 6.
>

Defunct even (means not working, right?)

--
----------
Manno Bult
http://www.aloft.nl
• 8. Re: Place sprite on stage using Lingo
It obviously still works. I'm just saying that there's been no need to use
puppetSprite for many years now - since auto puppeting has been the norm
since Director 6.

--
Dave -
http://www.blurredistinction.com

• 9. Re: Place sprite on stage using Lingo

I alway thought autopuppeting was applied to sprites with a member in it
in the first place.
As far as I remembers pre 6 you even had to puppet 'filled' sprites
before applying a rollover. I thought auto puppet was a fix for that...

scripted sprite is indeed better since it applies a member and location
in one go. Just never really used it...

Oh well, you never stop learning.

--
----------
Manno Bult
http://www.aloft.nl
> It obviously still works. I'm just saying that there's been no need to use
> puppetSprite for many years now - since auto puppeting has been the norm
> since Director 6.
>

--
aloft
Hoge der A 20a
The Netherlands
info [ at ] aloft [ dot ] nl
http://www.aloft.nl
tel: 06-22360652
KVK: 02094451
Bnk: 21.23.89.408
• 10. Re: Place sprite on stage using Lingo
>>I alway thought autopuppeting was applied to sprites with a member in it
in the first place.

I see - yes, you're right. Before MX2004, you did need to use puppetSprite
to create a dynamic sprite. But that should've been the only time you'd have
needed it. Yeah, in pre 6 days, a lot was different for sure. There was the
rollover toolkit from Tab Julius though, that made rollovers easier.

--
Dave -
http://www.blurredistinction.com

• 11. Re: Place sprite on stage using Lingo
I remember the name, but as a very beginning scripter I wasn't much part
of the community to really remember well.

I just vaguely remember the horrible lists of "if rollOver(yada) then"-s
in the scriptchannel in dir 5. Maybe Tab would have been my savior :)

>>> I alway thought autopuppeting was applied to sprites with a member in it
> in the first place.
>
> I see - yes, you're right. Before MX2004, you did need to use puppetSprite
> to create a dynamic sprite. But that should've been the only time you'd have
> needed it. Yeah, in pre 6 days, a lot was different for sure. There was the
> rollover toolkit from Tab Julius though, that made rollovers easier.
>
>
>

--
----------
Manno Bult
http://www.aloft.nl