animation timings and key-repeat issues

Creating Games? Developing something for fun?

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
tperry2x
Posts: 22
Joined: Wed Apr 22, 2020 9:58 pm

animation timings and key-repeat issues

Post by tperry2x » Thu Apr 23, 2020 9:45 pm

Hi everyone.
Having a few real issues with animation speeds not being consistent across different platforms.
For example:
https://www.tsites.co.uk/downloads/anim ... prites.mp4
This seems to run fine and is a simple load of PNGs being loaded into a button, while the button is being moved across the card.
This is the same on both platforms (ignore the audio test button in the screenshot). The reason it's the same is because it uses no keyboard input for movement.

https://www.tsites.co.uk/downloads/anim ... vement.mp4
This shows a comparison between OSX and Windows when not only are pngs loaded in as sprites, but when the horizontal and vertical movement is changed dynamically. Windows does it almost instantly - the animation is too fast. OSX is a bit too laggy with the png frames and the movement sideways.

https://www.tsites.co.uk/downloads/anim ... c-test.mp4
Again, here you can see how fast the animation plays in Windows, and notice after the figure starts moving on Windows it stops because I have no native way I can figure out to control the key repeat rate.

https://www.tsites.co.uk/downloads/anim ... xample.mp4
You can see how much of an effect key repeat rate can be, so how is this controlled in Livecode and set back. Is there a 'get' and 'set' option?

Unfortunately, the more I try to use Livecode for games, the more it feels like it's fighting me every step of the way and being made to do something it really doesn't want to do in the first place. I do feel that there needs to be big improvements made on this front.

jiml
Posts: 185
Joined: Sat Dec 09, 2006 1:27 am
Location: Los Angeles

Re: animation timings and key-repeat issues

Post by jiml » Wed Apr 29, 2020 12:35 am

Perhaps instead of depending on the machine's rate of key events, you might base the animation rate on time.
Maybe use keydown simply to start the animation, which would be handled in the script of the object you are animating.

on keyDown theKey
switch theKey
case "A"
send "animateLeft" to control "animatedFigure"
break
case "D"
send "animateRight" to control "animatedFigure"
break
default
pass keyDown
end switch
end keyDown

Then put "animateLeft" and "animateRight" handlers in the script of control "animatedFigure".
Use send in time to advance to the next 'frame' of the animation.

Use keyUp to send "stopAnimation" to control "animatedFigure"

Jim Lambert

tperry2x
Posts: 22
Joined: Wed Apr 22, 2020 9:58 pm

Re: animation timings and key-repeat issues

Post by tperry2x » Thu Apr 30, 2020 11:23 pm

Hmmm, I think I know what you mean.
I've found that when I move the red dot with A and D keys, it drastically slows down any animations currently looping (the green square).
Can you see what I'm doing wrong?

https://www.tsites.co.uk/downloads/key- ... vecode.zip
Image

jiml
Posts: 185
Joined: Sat Dec 09, 2006 1:27 am
Location: Los Angeles

Re: animation timings and key-repeat issues

Post by jiml » Fri May 01, 2020 8:48 pm

Here I don't notice a slowdown of the rectangle when the oval is moving.
Mac OSX, LC 9.6.9 dp4

jiml
Posts: 185
Joined: Sat Dec 09, 2006 1:27 am
Location: Los Angeles

Re: animation timings and key-repeat issues

Post by jiml » Fri May 01, 2020 10:05 pm

I mean LC 9.6.0 dp4

Post Reply

Return to “Games”