#1: How to prevent screen turning off on my Android, while I'm using Gideros Android Player? It's pretty inconvenient to turn it on again and again while I'm testing app. Do I need to set an exception somewhere inside Android OS?
#2: How to regulate animation speed? I've tried to loop basic animation, but it's too quick by default, I need it slower:
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Hi guys! How to regulate animation speed on the fly? For example when button is clicked, animation starts playing a little bit faster. (I don't see in documentation any reference, like "MovieClip:setSpeed" or "MovieClip:increaseSpeed()", etc)
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Hi guys! Why am I getting error here? function arguments expected near 'then' What's wrong with syntax?
function MoveOrcGreenX(event)if event.x > orcGreen:getX thenprint("Mouse.X coordinate is bigger then orcGreen.X")endend
stage:addEventListener(Event.MOUSE_DOWN, MoveOrcGreenOnX)
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
forum's little bug I meant in my post: if event.x "is bigger than" orcGreen:getX()
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Guys! Why does my spite shake and how to avoid it?
function MoveOrcGreenX()local touchXloc = touchX
if orcGreen:getX()> touchXloc
then
orcGreen:setX(orcGreen:getX() - 3)elseif orcGreen:getX()< touchXloc then
orcGreen:setX(orcGreen:getX() + 3)endend
stage:addEventListener(Event.ENTER_FRAME, MoveOrcGreenX)
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
/joke on @Apollo14 look at him he is obviously on steroids, totally green so his shaking is normal:D \joke off
If you want to move your sprite better move him with touch event(touch start, touch end) not on enter frame event, i guess after your move finish your orc is changing his place +3 and -3 respectively on every frame, because of it he is shaking.
if you want to continue to move him on enter frame you can make a check value in your touch end event like moving= false , and use this check variable on your onenter frame event in the logical statements. So you will be sure that your green orc will not move anywhere even on steroids:D
thx @talis & @oleg ! Though it's not a proper way to move my steroid orc with ENTER_FRAME, I wonder how to avoid shaking with boolean "isMoving:? I introduced boolean but it still shakes
function MoveOrcGreenX()local touchXloc = touchX
local isMoving =falseif isMoving ==falsethenif orcGreen:getX()> touchXloc
then
isMoving =true
orcGreen:setX(orcGreen:getX() - 3)
orcGreen:setScaleX(-1)
isMoving =falseelseif orcGreen:getX()< touchXloc then
isMoving =true
orcGreen:setX(orcGreen:getX() + 3)
orcGreen:setScaleX(1)
isMoving =falseendendend--function end
stage:addEventListener(Event.ENTER_FRAME, MoveOrcGreenX)
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
I have 4 scenes. On mouse clicked if current scene is 1, then go to scene 2 On mouse clicked if current scene is 2, then go to scene 3 On mouse clicked if current scene is 3, then go to scene 4 On mouse clicked if current scene is 4, then go back to scene 1
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
scenes/Scene2.lua:10: attempt to index global ' self'(a nil value)
stack traceback:
scenes/Scene2.lua:10: infunction'init'[string"property.lua"]:52: infunction'__new'[string"property.lua"]:59: infunction'new'
scenemanager.lua:287: infunction'changeScene'
main.lua:23: infunction
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
lua should say the variable is 'self', not ' self' (with the extra spaces before the name). Maybe your file contains some blank characters (not spaces or tabs) before the self:addEventListener(). It could have happened if you copied/pasted the code from a web page.
lua should say the variable is 'self', not ' self' (with the extra spaces before the name). Maybe your file contains some blank characters (not spaces or tabs) before the self:addEventListener(). It could have happened if you copied/pasted the code from a web page.
Thanks a lot! Indeed there was a blank character somewhere. After rewriting code it works fine!
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
thx @oleg I've tried Event.TOUCHES_MOVE, now effect became better, but there are lots of interruptions on the line:
variant1: save the coordinates of the previous point find the distance between the points math.sqrt((X1-X2)^2+(Y1-Y2)^2) generate additional points between them variant2: points to connect lines
Is it a good practice to use them whenever we can? How do they affect perfomance?
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
They improve performance by not having to look up the variable in a table and also because the byte compiler will pre-calculate formulas if it can so constants will end up being part of that precalculation but variable won't.
eg local pi=3.142 a=pi*2
will compile into that in bytecode as it can't reduce it because pi is a variable and could change.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Comments
#1: How to prevent screen turning off on my Android, while I'm using Gideros Android Player? It's pretty inconvenient to turn it on again and again while I'm testing app. Do I need to set an exception somewhere inside Android OS?
#2: How to regulate animation speed?
I've tried to loop basic animation, but it's too quick by default, I need it slower:
Likes: Apollo14
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Likes: Ninjadoodle
https://deluxepixel.com
settings-->Developer Options-->remain active
How to enable Developer Options
Likes: Apollo14, Ninjadoodle
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
uh, I found how to make animation slower I should've been more alert reading reference manual
Likes: antix
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
For example when button is clicked, animation starts playing a little bit faster.
(I don't see in documentation any reference, like "MovieClip:setSpeed" or "MovieClip:increaseSpeed()", etc)
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Likes: antix, Apollo14
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
Why am I getting error here?
function arguments expected near 'then'
What's wrong with syntax?
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Likes: Apollo14
Fragmenter - animated loop machine and IKONOMIKON - the memory game
I meant in my post:
if event.x "is bigger than" orcGreen:getX()
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Likes: Apollo14
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
@Apollo14 look at him he is obviously on steroids, totally green so his shaking is normal:D
\joke off
If you want to move your sprite better move him with touch event(touch start, touch end) not on enter frame event, i guess after your move finish your orc is changing his place +3 and -3 respectively on every frame, because of it he is shaking.
if you want to continue to move him on enter frame you can make a check value in your touch end event like moving= false , and use this check variable on your onenter frame event in the logical statements. So you will be sure that your green orc will not move anywhere even on steroids:D
Likes: Apollo14
Likes: Apollo14
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
Though it's not a proper way to move my steroid orc with ENTER_FRAME, I wonder how to avoid shaking with boolean "isMoving:?
I introduced boolean but it still shakes
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Likes: Apollo14, antix
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
On mouse clicked if current scene is 1, then go to scene 2
On mouse clicked if current scene is 2, then go to scene 3
On mouse clicked if current scene is 3, then go to scene 4
On mouse clicked if current scene is 4, then go back to scene 1
Can this code be optimized?
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Likes: oleg, Apollo14, antix, pie
I'm in the process of studying Scene Manager...
Why I'm getting an error here? I've read @ar2rsawseen 's post, tried to do somewhat similar
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Maybe your file contains some blank characters (not spaces or tabs) before the self:addEventListener(). It could have happened if you copied/pasted the code from a web page.
Likes: Apollo14
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
I'm trying to spawn black pixels continuously while swiping, but they spawn only once.
First I've created class "dot.lua":
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
use partikles
http://docs.giderosmobile.com/reference/gideros/Particles/addParticles#Particles:addParticles
Likes: Apollo14, totebo, SinisterSoft, antix
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
I've tried Event.TOUCHES_MOVE, now effect became better, but there are lots of interruptions on the line: http://giderosmobile.com/forum/uploads/editor/8j/mg4jef8se8g1.gif
I've found @atilim 's "Fruit Ninja" old prototype on forum: http://giderosmobile.com/forum/discussion/1214/fruit-ninja-template-who-wants-to-contribute-with-me/p1
He did it using shape. Does somebody know if there is a less complicated way to do it?
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
save the coordinates of the previous point
find the distance between the points math.sqrt((X1-X2)^2+(Y1-Y2)^2)
generate additional points between them
variant2:
points to connect lines
variant3:
see the screenshot
Likes: SinisterSoft, antix, Apollo14
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
Is it a good practice to use them whenever we can? How do they affect perfomance?
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Likes: Apollo14, SinisterSoft
eg
local pi=3.142
a=pi*2
will compile into that in bytecode as it can't reduce it because pi is a variable and could change.
but
@pi=3.142
a=pi*2
will compile to this in bytecode
a=6.284
because the compiler will first make it a=3.142*2 then further reduce this to 6.284 before making the bytecode.
Likes: Apollo14
https://deluxepixel.com