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
TaraKeatingAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
RaydotConnect With a Mentor Commented:
I didn't explain this well.

A sprite's forecolor and backcolor affect the display of the WHOLE sprite.  So when you draw a cast member in the paint window, it's assumed to be drawn with the proper colors, but then the SPRITE to which the CAST MEMBER is attached is assumed to have a forecolor of 255 (black) and backcolor of 0 (white).  The same goes for work imported from photoshop (or wherever).  When you draw directly on the stage however, you create a quickdraw cast member and immediately attach it to a sprite with the same forecolor and back color.

To see the effect of this, try creating a red square in the paint window, and a red square on stage.

Put the following script in the score script channel:

on exitFrame
   go to the frame
end

Then play the movie, and in the message window type the following:

sprite(1).forecolor = 180
sprite(2).forecolor = 180

The sprites will be two completely different colors, even though their colors are set the same in Lingo and they're the same color as cast members.

It's very important -- and a stumbling block for a lot of Director users -- to maintain a distinction between a sprite and a cast member attached to it.  When you change the forecolor and the backcolor, you're changing the colors of the SPRITE, and not the CAST MEMBER attached to them.  The cast member That might be why you're not so sure about how it works.

Try changing the inks of the sprites too, you'll see more of the same.

So if you create a cast member and you want complete control over the color change, really the best way is to create another cast member of a different color and switch the cast member attached to the sprite, and not the color of the sprite itself.  Make sense?
0
 
RaydotCommented:
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...


0
 
TaraKeatingAuthor Commented:
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
0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
RaydotCommented:
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.
0
 
RaydotCommented:
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?
0
 
RaydotCommented:
Have you given this any more effort, is it working for you?
0
 
TaraKeatingAuthor Commented:
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
0
 
TaraKeatingAuthor Commented:
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
0
 
RaydotCommented:
Sure!  Glad I could help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.