> 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)
Yes, then upload your apk as an alpha, beta or whatever and it should then be enabled, you add the IAP in the play console, then add it to your Lua code.
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
Guys, how can we make colored PNG picture black-and-white? (after adding it to stage)
> 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)
@Apollo14 I think a shader is the only option, I have not tested setColorTransform() but I suppose it would render the bitmap as a black square. Could be worth a try though
Guys, how can we make colored PNG picture black-and-white? (after adding it to stage)
just make a black and white copy of png and upload it to the project,
that's really good and simple way, I'm surprised I didn't think about this method though in some cases just applying shader could be more convenient
> 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)
Why in the classic 'Button.lua' class it adds/removes bitmaps to stage every time? Isn't it better to just use "setTexture"? Original code inside Button.lua:
if state thenif self:contains(self.upState)then
self:removeChild(self.upState)endifnot self:contains(self.downState)then
self:addChild(self.downState)endelse--...
My guess:
local btnTextureNormal,btnTexturePushed=Texture.new("pics/btn_normal.png",true),Texture.new("pics/btn_pushed.png",true)local btn=Bitmap.new(btnTextureNormal)
stage:addChild(btn)
stage:addEventListener(Event.TOUCHES_BEGIN, function()
btn:setTexture(btnTexturePushed)end)
stage:addEventListener(Event.TOUCHES_END, function()
btn:setTexture(btnTextureNormal)end)
> 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, when we work with classes, we should avoid attaching objects to 'self'? (make them all local wherever we can?)
function StartScene:init()
self.bg=Bitmap.new(Texture.new("pics/background.png",true))
self:addChild(self.bg)
self.iconCoin=Bitmap.new(Texture.new("pics/icon_coin.png",true))
self:addChild(self.iconCoin)end
OR:
function StartScene:init()local bg=Bitmap.new(Texture.new("pics/background.png",true))
self:addChild(bg)local iconCoin=Bitmap.new(Texture.new("pics/icon_coin.png",true))
self:addChild(iconCoin)end
> 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)
Yes, if possible, because local variables are a lot faster. A couple of things to note:
- You can make local variables scoped to the class if you declare them outside the functions. By doing this at the top of the document all methods can share the var. - If you do use class scoped local vars, they will be shared by all instances. This might not be desirable, in which case you have to use self.var.
Yes, if possible, because local variables are a lot faster. A couple of things to note:
- You can make local variables scoped to the class if you declare them outside the functions. By doing this at the top of the document all methods can share the var. - If you do use class scoped local vars, they will be shared by all instances. This might not be desirable, in which case you have to use self.var.
wow this is exactly what I wanted to know, many thanks!
> 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)
I've created 'StartScene.lua', loaded it with SceneManager as usual. I don't get why I can't access object 'StartScene.bg' from outside of StartScene:init() function?
StartScene = Core.class(Sprite)function StartScene:init()
self.bg=Bitmap.new(Texture.new("pics/background.png",true))
self:addChild(self.bg)
self.iconCoin=Bitmap.new(Texture.new("pics/icon_coin.png",true))
self:addChild(self.iconCoin)endfunction StartScene:setObjectsVisible(param)if param==falsethen
self.bg:setVisible(false)elseif param==truethen
self.bg:setVisible(true)
self.iconCoin:setVisible(true)endend--this function doesn't work when I call it later:
StartScene:setObjectsVisible(false)--StartScene.lua:201: attempt to index field 'bg' (a nil value)
> 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)
Is it possible somehow to access 'StartScene.bg' object? Or I should stick to the solution with local vars scoped to the class?
> 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)
If I recall correctly, I think that you can use sceneManager.scene1.bg
bg has to be a property of your scene class, and your scene has to be the current one (has to be loaded by sceneManager)
it doesn't work
StartScene.lua:201: attempt to index field 'startScene'(a nil value)
> 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)
@Apollo14 wait, don't be sad I feel there is something wrong in your implementation if you get the name of the scene in the error output. It may still work:
Assuming your sceneManager instance is called SM and you have opened your startScene there:
SM.scene1.bg should return something (still if I am not wrong, I can't check how I did it right now.. )
If the code you provided is your actual code, and you already loaded "startScene" there, it should be:
sceneManager.scene1:SetObjectsVisible (false)
And of course, to make it work you should have access to the sceneManager instance (which is the parent of your loaded scene): so it should be either a global object or if it's a local object you have to call it from within the same scope.
P.s. however you could also check sceneManager source to fix naming: it seems to me that it used self.scene1 and self.scene2 to store scenes and apply the transitions.
author of Zerobrane Studio mentioned that whole Zerobrane program was made using Lua Do you know what IDE is used for developing and compiling windows software like that? (using Lua)
> 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)
Comments
There's no 'billing permission' in Gideros' 'Require' plugin.
It sets automatically when we include 'IAP' plugin?
"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://deluxepixel.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)
Likes: Apollo14
Fragmenter - animated loop machine and IKONOMIKON - the memory game
2-Sprite.ONE,
3-Sprite.SRC_COLOR,
4-Sprite.ONE_MINUS_SRC_COLOR,
5-Sprite.DST_COLOR,
6-Sprite.ONE_MINUS_DST_COLOR,
7-Sprite.SRC_ALPHA,
8-Sprite.ONE_MINUS_SRC_ALPHA,
9-Sprite.DST_ALPHA,
10-Sprite.ONE_MINUS_DST_ALPHA,
11-Sprite.SRC_ALPHA_SATURATE
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
Likes: pie, oleg, keszegh, antix, Apollo14
I feel there is a need to give an order to all these useful examples and snippets!
Likes: Apollo14
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
though in some cases just applying shader could be more convenient
"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
hgy29 answered while I was writing, and I did not see his answer
Likes: Apollo14
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
Isn't it better to just use "setTexture"?
Original code inside Button.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)
Likes: Apollo14
Fragmenter - animated loop machine and IKONOMIKON - the memory game
I think the answer is yes, most of the time.
My custom Button class still uses sprites and setVisible() instead. This allows me to use movie clips, or custom classes, for each button state.
If that's not needed, bitmap:setTextureRegion() is probably the most efficient.
Likes: Apollo14, 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)
- You can make local variables scoped to the class if you declare them outside the functions. By doing this at the top of the document all methods can share the var.
- If you do use class scoped local vars, they will be shared by all instances. This might not be desirable, in which case you have to use self.var.
Likes: Apollo14
Likes: totebo
"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)
Either my syntax is incorrect, or there's a bug:
"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
I don't get why I can't access object 'StartScene.bg' from outside of StartScene:init() function?
"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)
something like that?
"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)
Or I should stick to the solution with local vars scoped to the class?
"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)
bg has to be a property of your scene class, and your scene has to be the current one (has to be loaded by sceneManager)
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)
Assuming your sceneManager instance is called SM and you have opened your startScene there:
SM.scene1.bg should return something (still if I am not wrong, I can't check how I did it right now.. )
If the code you provided is your actual code, and you already loaded "startScene" there, it should be:
sceneManager.scene1:SetObjectsVisible (false)
And of course, to make it work you should have access to the sceneManager instance (which is the parent of your loaded scene): so it should be either a global object or if it's a local object you have to call it from within the same scope.
P.s. however you could also check sceneManager source to fix naming: it seems to me that it used self.scene1 and self.scene2 to store scenes and apply the transitions.
Do you know what IDE is used for developing and compiling windows software like that? (using 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)
Likes: Apollo14
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
Lua really needs a decent IDE like Visual Studio with drag and drop GUI creation.