Hi!
I'm trying to make a maze with a character with different sides when going different directions.
I tried something like this, but it does not work.
I imported the 4-direction pictures into a new card with individual names.
I tried
on arrowkey the key
if the key is "right" then
replace img "player" with img"player-right"
end arrowkey
what is the right way to do it?
Thanks !!!
How to change icon when different arrow key activated?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: How to change icon when different arrow key activated?
Hi layrian,
Welcome to the forum
If you look-up "replace" in the dictionary you'll see that it's only for text.
Look-up "filename".
And umm... no need for the styled font in your postings unless you need it.
Simon
Welcome to the forum

If you look-up "replace" in the dictionary you'll see that it's only for text.
Look-up "filename".
And umm... no need for the styled font in your postings unless you need it.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: How to change icon when different arrow key activated?
layrian…
make the images that you have imported into your stack invisible through their property inspectors. In the development ‘menu’… select ‘Image Library’. You will see your imported images there. Move the cursor over them and note their ID numbers…
Place a transparent button on your card and in the script of the card use something like this…
I'va attached a stack, so that you can see it working
Dixie
make the images that you have imported into your stack invisible through their property inspectors. In the development ‘menu’… select ‘Image Library’. You will see your imported images there. Move the cursor over them and note their ID numbers…
Place a transparent button on your card and in the script of the card use something like this…
Code: Select all
on arrowkey theKey
switch theKey
case "left"
set the icon of button 1 to 1007
break
case "right"
set the icon of button 1 to 1008
break
case "up"
-- You could also do something here
break
case "down"
-- You could also do something here
break
end switch
end arrowkey
Dixie
- Attachments
-
- arrowkeyCharacter.livecode.zip
- (2.38 KiB) Downloaded 142 times
Re: How to change icon when different arrow key activated?
HI layrian,
1. welcome to the forum!
2. I removed the unneccessary font size setting!
You will not get more attention when using bigger fonts, au contraire, mon ami
Best
Klaus
1. welcome to the forum!

2. I removed the unneccessary font size setting!
You will not get more attention when using bigger fonts, au contraire, mon ami

Best
Klaus