Re: arrowKey 'up' and 'down'
Heres my take on it. Moved most of the code to the graphic. Game loops work so much better for this type of thing because you avoid the "arrowkey" repeat problem entirely. All it does is loop, look at what keys are down, and acts appropriately. Changed the move distance to 5, and increment a counter to pick the next animation frame. Added a start button to start and stop the loop. Great penguin graphics, love the affect! Heres a link to the modified stack. On Sun, Apr 24, 2016 at 1:43 AM, RM wrote: > Of course my next problem is how, when a punter presses the arrowKey to > have it "fire" only once: i.e. then chummy keeps his/her finger on the key > it doesn't continue sending arrowKey signals after the first one. > > Richmond. > > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: arrowKey 'up' and 'down'
OOps, heres the link. https://dl.dropboxusercontent.com/u/11957935/ANIMATION%209.5.livecode On Sun, Apr 24, 2016 at 8:41 AM, Mike Bonner wrote: > Heres my take on it. Moved most of the code to the graphic. Game loops > work so much better for this type of thing because you avoid the "arrowkey" > repeat problem entirely. > > All it does is loop, look at what keys are down, and acts appropriately. > Changed the move distance to 5, and increment a counter to pick the next > animation frame. > > Added a start button to start and stop the loop. Great penguin graphics, > love the affect! > > Heres a link to the modified stack. > > > On Sun, Apr 24, 2016 at 1:43 AM, RM wrote: > >> Of course my next problem is how, when a punter presses the arrowKey to >> have it "fire" only once: i.e. then chummy keeps his/her finger on the key >> it doesn't continue sending arrowKey signals after the first one. >> >> Richmond. >> >> >> ___ >> use-livecode mailing list >> use-livecode@lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your >> subscription preferences: >> http://lists.runrev.com/mailman/listinfo/use-livecode >> > > ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: arrowKey 'up' and 'down'
Of course my next problem is how, when a punter presses the arrowKey to have it "fire" only once: i.e. then chummy keeps his/her finger on the key it doesn't continue sending arrowKey signals after the first one. Richmond. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: arrowKey 'up' and 'down'
"pass arrowKey" sorted things out rather well: thanks a lot! https://www.dropbox.com/s/5ym1zrzebsfrbyy/ANIMATION%209.5.livecode.zip?dl=0 Richmond. On 24.04.2016 08:44, Peter Bogdanoff wrote: Also, you might include “pass arrowKey” at the end of the script Peter On Apr 23, 2016, at 12:49 PM, RM wrote: Thanks for those recommendations; will try them tomorrow as it is almost my bedtime over here in Bulgaria. Richmond. On 23.04.2016 22:31, J. Landman Gay wrote: On 4/23/2016 1:00 PM, RM wrote: (pseudocode) on arrowKey ArKey if ArKey = "right" then move object in some way this line defines send signal to object to initiate animation script within object end if end arrowKey when I hit my right arrow key ONCE the object moves and then animates ONCE. HOWEVER, if I keep my finger on the right arrow key the movement repeats, but the multiple instances of the "send signal to object" scriptLine get "saved up" and fire at the point I take my finger off the arrow key; The signals are added to a queue but don't get a chance to fire, presumably because the arrowkey message is happening repeatedly. Queued messages need some idle time before they'll execute. This might work better if you add "without waiting" to the move command, allowing the handler to continue immediately, and then call the animation handler directly without using "send". How can I tell when an end-user ('punter') has stopped pressing an arrowKey? Try rawKeyUp, but you may not need that if you change the move command. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: arrowKey 'up' and 'down'
Also, you might include “pass arrowKey” at the end of the script Peter On Apr 23, 2016, at 12:49 PM, RM wrote: > Thanks for those recommendations; will try them tomorrow as it is almost my > bedtime > over here in Bulgaria. > > Richmond. > > On 23.04.2016 22:31, J. Landman Gay wrote: >> On 4/23/2016 1:00 PM, RM wrote: >>> (pseudocode) >>> >>> on arrowKey ArKey >>> if ArKey = "right" then >>>move object in some way this line defines >>>send signal to object to initiate animation script within object >>> end if >>> end arrowKey >>> >>> when I hit my right arrow key ONCE the object moves and then animates ONCE. >>> >>> HOWEVER, if I keep my finger on the right arrow key the movement >>> repeats, but the multiple >>> instances of the "send signal to object" scriptLine get "saved up" and >>> fire at the point I take my finger >>> off the arrow key; >> >> The signals are added to a queue but don't get a chance to fire, presumably >> because the arrowkey message is happening repeatedly. Queued messages need >> some idle time before they'll execute. >> >> This might work better if you add "without waiting" to the move command, >> allowing the handler to continue immediately, and then call the animation >> handler directly without using "send". >> >>> How can I tell when an end-user ('punter') has stopped pressing an arrowKey? >> >> Try rawKeyUp, but you may not need that if you change the move command. >> > > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: arrowKey 'up' and 'down'
Thanks for those recommendations; will try them tomorrow as it is almost my bedtime over here in Bulgaria. Richmond. On 23.04.2016 22:31, J. Landman Gay wrote: On 4/23/2016 1:00 PM, RM wrote: (pseudocode) on arrowKey ArKey if ArKey = "right" then move object in some way this line defines send signal to object to initiate animation script within object end if end arrowKey when I hit my right arrow key ONCE the object moves and then animates ONCE. HOWEVER, if I keep my finger on the right arrow key the movement repeats, but the multiple instances of the "send signal to object" scriptLine get "saved up" and fire at the point I take my finger off the arrow key; The signals are added to a queue but don't get a chance to fire, presumably because the arrowkey message is happening repeatedly. Queued messages need some idle time before they'll execute. This might work better if you add "without waiting" to the move command, allowing the handler to continue immediately, and then call the animation handler directly without using "send". How can I tell when an end-user ('punter') has stopped pressing an arrowKey? Try rawKeyUp, but you may not need that if you change the move command. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: arrowKey 'up' and 'down'
On 4/23/2016 1:00 PM, RM wrote: (pseudocode) on arrowKey ArKey if ArKey = "right" then move object in some way this line defines send signal to object to initiate animation script within object end if end arrowKey when I hit my right arrow key ONCE the object moves and then animates ONCE. HOWEVER, if I keep my finger on the right arrow key the movement repeats, but the multiple instances of the "send signal to object" scriptLine get "saved up" and fire at the point I take my finger off the arrow key; The signals are added to a queue but don't get a chance to fire, presumably because the arrowkey message is happening repeatedly. Queued messages need some idle time before they'll execute. This might work better if you add "without waiting" to the move command, allowing the handler to continue immediately, and then call the animation handler directly without using "send". How can I tell when an end-user ('punter') has stopped pressing an arrowKey? Try rawKeyUp, but you may not need that if you change the move command. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode