PDA

View Full Version : swapping instance images


advancedage
05-24-2008, 11:34 AM
Hello, I'm new to flex and need a little help porting my code to AS3 from gamemaker. I've searched for several days here, google and at livedocs but I can't figure it out.

This is my prototype for xinks http://youtube.com/watch?v=ssYn0Fcyd3E

In my game I have a draw event and use a switch statement to control which .png's appears on an instance at any given moment. This is the heart of my game each instance must switch its sprite randomly to a new sprite once out of site and move to the other side.

Using this code I can't see how to accomplish the same thing.
[Embed(source='assets/yellow1.png')]
private static var StonePNG : Class;



The current code for my gamemaker game is :

switch(sprite)
{
case 0:draw_sprite_ext(yellow1,0,x,y,s,s,0,blend,.9);co lor=0;shape=0;std=0; break;
case 1:draw_sprite_ext(red1,0,x,y,s,s,0,blend,.9);color =1;shape=0; std=0;break;
case 2:draw_sprite_ext(blue1,0,x,y,s,s,0,blend,.9); color=2;shape=0;std=0;break;
case 3:draw_sprite_ext(purple1,0,x,y,s,s,0,blend,.9); color=3; shape=0;std=0;break;
etc......
}


any help would be greatly appreciated. If it helps I have coded in java and C++ but never for games.