Solved

Initializing the color of sprites - startMovie?

Posted on 2001-08-18
9
722 Views
Last Modified: 2013-12-24
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
0
Comment
Question by:TaraKeating
  • 6
  • 3
9 Comments
 
LVL 3

Expert Comment

by:Raydot
ID: 6410808
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
 

Author Comment

by:TaraKeating
ID: 6410991
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
 
LVL 3

Expert Comment

by:Raydot
ID: 6411051
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
 
LVL 3

Expert Comment

by:Raydot
ID: 6411052
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 3

Expert Comment

by:Raydot
ID: 6422927
Have you given this any more effort, is it working for you?
0
 

Author Comment

by:TaraKeating
ID: 6424902
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
 
LVL 3

Accepted Solution

by:
Raydot earned 50 total points
ID: 6425293
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
 

Author Comment

by:TaraKeating
ID: 6426072
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
 
LVL 3

Expert Comment

by:Raydot
ID: 6428539
Sure!  Glad I could help.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

In this short web based tutorial, I wanted to show users how they can still use the powers of FrontPage in conjunction with Expression Web 3.  Even though Microsoft eliminated the use of Web components, we can still use them with FrontPage and edit …
Now that Expression Web 4.0 (http://www.microsoft.com/expression/products/Upgrade.aspx) is free if you buy or have the full version of Expression Web 3.0, now is the best time to  migrate from FrontPage to Expression Web (http://www.frontpage-to-exp…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now