Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Balloons
Started by iphone_2010 Nov 05 2010 02:55 PM

3 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

iphone_2010

[GLOBAL: userInfoPane.html]
iphone_2010
  • Enthusiast

  • 92 posts
  • Guests

I have just started and have created a simple game to randomly display balloons on the screen using the physics engine. The balloons move from up screen and keeps moving till disappearance. The user will be able to click on a balloon to bomb it. i have used the following function in the Even listener to call the display ballon function:-

function DisplayBalloon(event)
local indexFileNumber = objectX(1,11)
local balloonObject = display.newImage( "balloon1.png" )
balloonObject.x = objectX(-50, 320)+5
physics.addBody(balloonObject, {density=0.0, bounce = 0.0, radius=30, friction=0.0 })
balloonObject:addEventListener( "touch", moveBalloon )
end

function startBalloons ( event )
DisplayBalloon()
--timer.performWithDelay(150, DisplayBalloon,1)
end
Runtime:addEventListener( "enterFrame", startBalloons)

The have used the "EnterFrame" even to call the balloon function using the global Runtime object. The problem is that when i used that function it calls the function every millisecond so its crowded the screen area in less than 10 seconds. How can i change the above code to call that function lets say every 1 second.

Another question please, for memory management, i read that for better performance using group will help in memory management and i have no idea how to use that and what is the benefit of the group concept. and how can apply it in my app.

Thanks
uid: 11038 topic_id: 3448 reply_id: 303448


[TOPIC: post.html]
#2

delta

[GLOBAL: userInfoPane.html]
delta
  • Observer

  • 15 posts
  • Guests

You can use the delay technique, outlined roughly in this thread and call it from outside the onEnterFrame function.

http://developer.anscamobile.com/forum/2010/07/27/create-new-object-based-timer
uid: 7396 topic_id: 3448 reply_id: 10341


[TOPIC: post.html]
#3

iphone_2010

[GLOBAL: userInfoPane.html]
iphone_2010
  • Enthusiast

  • 92 posts
  • Guests

Thanks very much for your support.

I'm really new in game development field and OOP and really would like to have your support. I needful know where I should start from to learn Coroa and what's the best way to use? Like starting from where? Should I writting code along with start reading or what do you recommend?

Thanks
uid: 11038 topic_id: 3448 reply_id: 10377


[TOPIC: post.html]
#4

DavidBFox

[GLOBAL: userInfoPane.html]
DavidBFox
  • Contributor

  • 179 posts
  • Corona SDK

iphone_2010, I'm relatively new to Corona too... there's a lot to learn and I'm finding lots of great resources. For me, having all the examples of programs and code snippets here helps the most. I can then take those, read through until I understand, and then start tweaking parts to see how that changes things... or adding on to a program to make it do something different.

Definitely download both the Game SDK and the regular one. There are sample programs in both that illustrate all sorts of things. If you know what the examples do, you'll know where to look to borrow code for your own programs. For me, that's the training wheels... then after I get more familiar with it all, I find I get more and more confident writing original code.

And of course, read the forum questions, comments, answers. Lots of people are asking the same questions, so it helps to search for what you're looking for.
uid: 9905 topic_id: 3448 reply_id: 10405



[topic_controls]
[/topic_controls]