change image by direction=...

hi guys,
question:
by a direction of for example 0,2 the image must change to image_1
by a direction of for example 0,4 the image must change to image_2
etc.
i can do this with
rule:
when attribute game.direction = 0,2{
change image to image_1
}
otherwise{
rule
when attribute game.direction = 0,4{
etc.
only, the animation have a lot (17) of frames... this makes gamesalad very slow...
can i do this faster???
wouter
question:
by a direction of for example 0,2 the image must change to image_1
by a direction of for example 0,4 the image must change to image_2
etc.
i can do this with
rule:
when attribute game.direction = 0,2{
change image to image_1
}
otherwise{
rule
when attribute game.direction = 0,4{
etc.
only, the animation have a lot (17) of frames... this makes gamesalad very slow...
can i do this faster???
wouter
Comments
so it can be all directions...
constain attribute:
self.Image to ceil(( game.direction real *10)2) game.up game.>evenwichtinteger ".png"
game.direction real = direction in decimal. game.up is up=2 and down=1
and game.>evenwichtinteger = 1 above balance and 0 under blance. (sinus function)
i have images called 110, 111, 120,121, 210,211,220,221,310,311,320,321,410,411,420,421,510,511,520,611. (all .png)
but, get no images... what do i wrong?
wouter
edit:
(doesn't matter in this case by the way;)
also if u didnt know you can use linear motion to determine direction and you can change images off that
if motion linear x is > 0 your going right, if its < 0 your going left
if motion linear y is >0 you moving up, and if its < 0 your goign down
if the direction comes close to 0 you are almost by an maximum or minimum and the animation is also different if it's by a maximum or minimum so that's the reason why i used above or under balance (=evenwicht in dutch^^;) and up...
so i don't think i can use motion linear x or y in this case;)
only there's only a withe box so he didn't show images...
what do i wrong... xD
game direction is usually around -1,0,1 and if you move the sin it has tops of around 6 and -6..
so it's logic that he doesn't show images above 1.2 (direction) (6*2/10) but under he doesn't either! (in the area of -1.2 to 1.2).....
ceil(( game.direction real *10)/2) + game.up + game.>evenwichtinteger ".png"
the actor don't move?!
ah even if i do self.Image to 111.png there happened nothing... (only a white block)... only why xD
edit2
this is because it must be "111.png"
only if i do this:
"ceil(( game.direction real *10)/2) game.up game.>evenwichtinteger ".png""
or:
"ceil(( game.direction real *10)/2) game.up game.>evenwichtinteger .png"
this doesn't also work:
"ceil(( game.direction real *10)/2) game.up game.>evenwichtinteger ".png
this is frustrating...
ceil(( game.direction *10)/2)..".png"
Including the ..".png"
ceil(( game.direction real *10)/2) game.up game.>evenwichtinteger ..".png"
and doesn't work...
i have images called 110, 111, 120,121, 210,211,220,221,310,311,320,321,410,411,420,421,510,511,520,611. (all .png)
up is 2 if goes up and one if goes down
game.>evenwichtinteger is 1 if above the balance and 0 under the balance...
direction is usual +- around -1,0,1 and with controls it can reach 6..
Anyone??
in this tread: http://gamesalad.com/forums/topic.php?id=24031
they are using more .. (... xD)
only going up is good (only the animation not jet xD), but going down is a white block so an attribute is wrong but it showed something!!!:D
why have you put that in there?
lol i'm so happy i find out after 2 days...:D
if direction=0{
if max then image_max
if min then image_min
}
otherwise{
constrain attribute self.image to ....
}
only... i have not for every direction an image so is there a way to do if image exist then image... otherwise keep image??
wouter
rule that when going up is true:
constrain attribute self.image to: "up"..ceil(( game.direction *10)/2)..".png"
OTHERWISE
constrain attribute self.image to: "down"..ceil(( game.direction *10)/2)..".png"
Name your images up1.png, up2.png, up3.png etc for all the images in the up animation and down1.png, down2.png, down3.png etc for images in the down animation
only if the image doesn't exist don't change him... how can i do that?
(oh and some images resize in my animation... ugly:@ xD so i have to make al the images the same size... (and some will have more alpha layer then others..)