It looks like you're new here. If you want to get involved, click one of these buttons!
application:setBackgroundColor(0x02020f) --creating one more star every 1000ms function createStar() star = Shape.new() star:setFillStyle(Shape.SOLID, 0xF0F1F2, 1) star:beginPath() star:moveTo(0,0) star:lineTo(1, 0) star:lineTo(1, 1) star:lineTo(0, 1) star:lineTo(0, 0) star:endPath() star:setPosition(math.random(20,300), 30) stage:addChild(star) end starsTimer = Timer.new(1000, 0) starsTimer:addEventListener(Event.TIMER,createStar) starsTimer:start() --moving all stars down function everyTick() star:setY(star:getY()+1) end stage:addEventListener(Event.ENTER_FRAME,everyTick) |
Comments
The way you’re doing it - I think it might be looking for a star before it’s even created.
Likes: Apollo14
Likes: Apollo14, totebo
but stars stop moving when other stars spawn, how to make them continue going down?
I didn't learn about Lua classes yet))
"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)
https://www.lua.org/pil/19.2.html
http://lua-users.org/wiki/ForTutorial
Likes: hgy29, Apollo14
Likes: antix, Apollo14
https://deluxepixel.com
I’ll post you an example shortly
Likes: antix, Apollo14
@Apollo14, making a large array of one pixel shapes wouldn't be the most efficient use of resources. The suggestion of @SinisterSoft to use particles is most likely the best solution. If you really needed separate objects then the Pixel class would be a better option as they would perform faster than Shapes.
As an exercise I made a small class that creates that moves (in parallax) a multi layered star field made from Pixels. Each layer has more stars than the previous layer and also moves slower than the previous layer also. Maybe you can find a use for it or maybe you will use particles instead
Likes: Apollo14
I always use one main.lua to initiates all scenes in SceneManager when the game starts and then Core.class(Sprite) to create classes for everything as you can see in my complete example game:
https://github.com/jdbcdev/Dots
Practice with Gideros examples and read some lua tutorial to understand syntax before to start creating a game.
Likes: Apollo14
https://support.google.com/admob/answer/7562314?ctx=email What SDK versions does Gideros use?
"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
Слава Україні!
Likes: Apollo14
https://deluxepixel.com
It freaks me out, I don't understand a damn f-ing thing in chapter 2.2 "Creating Scenes", either it is extremely newbie-unfriendly, or something is wrong with me personally.
I'm gonna check what's in "step-by-step tutorials" on forum, if there is something that is possible for me to understand from the start. If there is no such stuff, I don't know what to do. Chapter 2.2 raped my brains and it hurts.
"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 he can help address what you don't understand?
Likes: Apollo14
https://deluxepixel.com
Have you come across this?? http://appcodingeasy.com/Gideros-Mobile/Manage-Scenes-in-Gideros-Mobile
I think you would learn more from downloading SceneManager from its GitHub page and looking at the example which shows pretty clearly how scenes work. https://github.com/gideros/Scene-Manager
Let us know if you're still having brain freeze :bz
Likes: Apollo14
Scenes is Gideros are actually REALLY easy (it just take a little while to understand).
Remember to include the scenemanager.lua file, then do something like this ...
in your main.lua
Likes: Apollo14
Likes: Ninjadoodle, Apollo14
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Likes: Apollo14, antix
https://deluxepixel.com
Likes: SinisterSoft
Fragmenter - animated loop machine and IKONOMIKON - the memory game
"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)
Once you understand it, it will become second nature ... Gideros is the easiest/most straight forward tool to code in, that I've encountered (that includes visual tools like Construct 2).
An Event Listener is just a piece of code you attach to a sprite/object, that waits for something to happen.
For example a TOUCH EVENT LISTENER will wait for you to touch the sprite you've attached it to, then run the function you've attached to the listener (for example - play a sound effect and goto Scene 2).
Likes: Apollo14
I've tried to implement vibration real quick with "application:vibrate()"
It vibrates too long. Is it possible to make it shorter? Like short standard Android vibe when we navigate apps.
I didn't find any documentation on this essential feature.
If vibration settings currently are not supported in Gideros, maybe it would be better to make this default vibration short? It will be very handy, because that long vibration rarely is suitable.
Thanks!
"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
https://deluxepixel.com
https://stackoverflow.com/questions/10570553/how-to-set-iphone-vibrate-length
Only in iOS 10+ is it allowed - using this api...
https://www.hackingwithswift.com/example-code/uikit/how-to-generate-haptic-feedback-with-uifeedbackgenerator
https://deluxepixel.com
https://deluxepixel.com
Likes: SinisterSoft
"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://deluxepixel.com
I checked basic example StarField.gproj, I don't understand how to make starry sky with particles. Can somebody pls make a quick example?
"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)
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!