Link to home
Start Free TrialLog in
Avatar of TaraKeating
TaraKeating

asked on

Initializing the color of sprites - startMovie?

Hi I'm new to Director (using version 7) and am completely self taught.  The solution to this question is therefore probably very simple but here goes:

I have a movie where I wish to present some sprites in one color and then have the user choose a new color and to recolor the sprites using lingo.

This sounds easy but so far I have set the movie properties to paletteindex rather than rgb, puppetted my sprites and still I cant get it to work.

I have tried putting the code to set the colors of the sprites in different places including the startMovie script since I want to set them right at the start and change them later on.  However, I can't get this script to run.  I put a break point in and it never hits it.  I was sure the startMovie script would run every time the movie was played but when I rewind and set the thing going it is definitely not going into this script.

Moreover, I cant get the sprites to change color when putting the code in other places such as the onMouseUp on the sprite behaviour.  Using a random color works but setting a specific one (Im using the WEB216 palette) doesn't.

Thanks

Tara
Avatar of Raydot
Raydot

Could you show us the code, that'd help.

Basically sprite color changes are most tightly based on changing the sprites forecolor and backcolor properties.  You shouldn't have to change the palettes.

Also, with d7 you shouldn't have to puppet sprites.

Here's a script that will change the color of a sprite that's clicked on.  The sprite is a solid color quickDraw object with the following attached:

on mouseUp me
  sprite(me.spriteNum).forecolor = random(255)
end

Keep in mind that if your graphics are done in photoshop, changing the forecolor might not have much of an effect.  So also, tell us how you created the art...


Avatar of TaraKeating

ASKER

In the movie properties "Palette Index" is selected and the default palette is WEB216

The code is

on startMovie
  set the puppet of sprite(2)  to true
  set the forecolor of sprite(2) = 81
  set the puppet of sprite(4)  to true
  set the forecolor of sprite(4) = 24
end startMovie

I sorted out the problem with executing startMovie - this was because the script was not a movie script according to its property - this now definitely executes, however the color of the sprite doesn't change even though the code executes okay.

The sprite is a single color sprite drawn via the filled rectangle tool.  It is 2 rectangles together in the shape of a tractor body  coloured bright yellow but I want to start it off as one color and change it later in the movie.  I thought it wouldnt matter what color I drew it in the paint window as I could change it with Lingo

I have also drawn the tractor wheels with the paint window using a filled circle with a pattern filling.  I need to change this too.

Thanks for your help

Tara
Ok, you don't have to puppet sprites.  That's out the window with d7 (actually 6, I think)  So forget doing that.  I think you can also forget that palette stuff, the default 256 color palette should be fine for what you're trying to do.  Also, you say "filled rectangle tool," but are you drawing in the paint window, or directly on stage?

Try doing this:

on startMovie
  sprite(2).forecolor = 81
  sprite(4).forecolor = 24
  updateStage
end

Tell me what that does.
Oh and one more thing, is your playback head properly controlled?  Is your movie looping in frames or is it just stopping as soon as you start it?
Have you given this any more effort, is it working for you?
Thanks for your comments Raydot.

I've done an experiment and I can only change the color of the sprites if I have drawn them directly onto the stage rather than drawn in the paint window -  as you hinted.

I'll accept your comment as an answer but  before I sign this question off - do  you know if there is any way I can get the sprites I created from cast members drawn in the paint window and dragged onto  the stage, (as opposed to drawn on the stage  directly) to take on new colors as directed by lingo?

Thanks for your help

Tara
ASKER CERTIFIED SOLUTION
Avatar of Raydot
Raydot

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Raydot,

I have another question about fillcolor and fillpattern and will post it separately if I have the points - will you take a look!

Tara
Sure!  Glad I could help.