LOL - should have double checked
Would be nice if the IDE would issue warnings for things like this (not errors but warnings as in other IDEs... would save SO much time debugging )
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
The IDE cannot warn you since for the IDE you set a custom property. And custom properties can perfectly be named "botton".Would be nice if the IDE would issue warnings for things like this (
I wasn't able to find a reference to CEL ANIMATION IN sample stacks (may well be due to my old age!) - can you link?
Hi Bernd - i definitely always have strict compilation on, having come from strongly typed environments that's a bit a safety i prefer. My right hand tends to touch type just a bit faster than my left(!) and it's not unusual that i misspell things (translocation of letters), so when it comes to variables i prefer this to be on.
Code: Select all
local sFrame
on marchSprite pDirection
if the shiftkey is down then exit marchSprite
put char 1 of pDirection into tDir
-- check if we're moving out of range:
if sFrame > 0 and (the right of grc "ramka" < 0 or \
the left of grc "ramka" > the right of img "B4.png") then
put 0 into sFrame
-- reset position so next iteration will work:
if tDir = "R" then set the left of grc "ramka" to (the right of img "B4.png" - 1)
else set the left of grc "ramka" to 1
exit marchSprite
end if
put (sFrame + 1) wrap 6 into sFrame
if tDir = "L" then put -4 into tStep else put 4 into tStep
lock screen
set the width of grc "ramka" to the width of img (tDir & sFrame & ".png")
set the height of grc "ramka" to the height of img (tDir & sFrame & ".png")
set the backGroundPattern of grc "ramka" to the ID of img (tDir & sFrame & ".png")
unlock screen
move grc "ramka" relative tStep,0 in 12 ticks -- less than this looks jerky on my Mac
send "marchSprite tDir" to me in 0
end marchSprite
Code: Select all
go stack url "http://netrin.on-rev.com/animateimage/roach3.livecode"
Thank Jim - had a look, that's really very clever!jiml wrote: ↑Tue Jul 20, 2021 4:27 pmStam,
Here's the link to Cel Animation
http://livecodeshare.runrev.com/stack/857/Cel-Animation
JimL
Code: Select all
set the AnimationData of me to empty
Code: Select all
put "" into lAnimationData
The ''L' just indicates that 'lAnimationData' is a local variable. Prepending an 'L' is just a variable naming convention and is not a requirement.the lAnimationData doesn't trigger an error with strict compilation on, suggesting it recognises this as a custom property and probably the AnimationData of me at that.
Is prefixing the custom prop of self with an 'L' a shortcut? i.e. is lAnimationData == the AnimationData of me in this case?