How do you add or remove images to a scene you are not in. Like if you are in a level and you want to add an level icon in the menu to “unlock” those levels. Like Angry Birds. [import]uid: 184688 topic_id: 33539 reply_id: 333539[/import]
Hello,
Unless you keep a scene in memory (not recommended, for simple memory reasons), you can’t manipulate its contents. What I would suggest is that you simply configure the scene initially to contain these display objects (an unlock button, whatever), but by default they are invisible. Then, when you return to that scene, you either pass a variable or read from some kind of text file about which levels are “unlocked” at the moment… as in, you use a common text file to save the user’s progress, stats, scores, etc. (which you would likely want to do anyway, so when they quit the app and return a week later, their progress is recorded and retained).
Does this help?
Brent
[import]uid: 200026 topic_id: 33539 reply_id: 133279[/import]
I am sad there isn’t an easy way to do this but what were you talking about when you said a user can return a week later an be at the same place?
Avery [import]uid: 184688 topic_id: 33539 reply_id: 133287[/import]
Why not use like a SQLite database? Just add a table that contains all the levels and you lock/unlock them there, then have the levels menu read which levels are locked/unlocked from the database each time you open the menu.
That or a simple .txt or .xml would be enough.
Anyways, here is how I use the SQLite
[lua]–Include sqlite
require “sqlite3”
–Open database.db. If the file doesn’t exist it will be created
local path = system.pathForFile(“database.db”, system.ResourceDirectory)
db = sqlite3.open( path )
local function readDatabaseTest()
local t = “”
for row in db:nrows(“SELECT * FROM users”) do
local reading = row.id…" - "…row.column
t = " "…reading
end
return t
end[/lua] [import]uid: 53195 topic_id: 33539 reply_id: 133292[/import]
Exactly as @alfgogo says, you need to implement some sort of saving method into almost every app. If the app closes (permanently closes, not just “sleeps”), you’ll lose all local data. So, you need some method to save game state to a text file or SQLite database located in the app’s Documents directory. Then when the user returns at any time, you read the info and make changes to a scene… that might be a high score, which levels are unlocked, the custom volume level the user has chosen, etc.
Take a look here: Peach has created a nice module to save/load data:
http://corona.techority.com/2012/01/22/easy-level-unlocking-with-ego/
Brent [import]uid: 200026 topic_id: 33539 reply_id: 133324[/import]
Hi @agollnick1
I am sad to hear you said you sad.
Because this is consider ‘easy way’.
Try to do the same thing using other language/SDK, will take you longer learning time.
Be patient, you will master it in no time.
Happy coding!
[import]uid: 31508 topic_id: 33539 reply_id: 133330[/import]
I don’t have a twitter so i can’t get it
It looks complex from what I see in the comments. [import]uid: 184688 topic_id: 33539 reply_id: 133379[/import]
Corona is pretty much the easiest it gets if you want quality. Anyways, this is actually pretty easy, just make a SQLite database or txt file and play with the code I pasted, or use the Peach tutorial. It’s really nothing compared to the rest of programming you’ll have to do if you’re making a game, which is still pretty simple with Corona [import]uid: 53195 topic_id: 33539 reply_id: 133388[/import]
I don’t have a twitter so i can’t get it. [import]uid: 184688 topic_id: 33539 reply_id: 133392[/import]
Hello,
Unless you keep a scene in memory (not recommended, for simple memory reasons), you can’t manipulate its contents. What I would suggest is that you simply configure the scene initially to contain these display objects (an unlock button, whatever), but by default they are invisible. Then, when you return to that scene, you either pass a variable or read from some kind of text file about which levels are “unlocked” at the moment… as in, you use a common text file to save the user’s progress, stats, scores, etc. (which you would likely want to do anyway, so when they quit the app and return a week later, their progress is recorded and retained).
Does this help?
Brent
[import]uid: 200026 topic_id: 33539 reply_id: 133279[/import]
I am sad there isn’t an easy way to do this but what were you talking about when you said a user can return a week later an be at the same place?
Avery [import]uid: 184688 topic_id: 33539 reply_id: 133287[/import]
Why not use like a SQLite database? Just add a table that contains all the levels and you lock/unlock them there, then have the levels menu read which levels are locked/unlocked from the database each time you open the menu.
That or a simple .txt or .xml would be enough.
Anyways, here is how I use the SQLite
[lua]–Include sqlite
require “sqlite3”
–Open database.db. If the file doesn’t exist it will be created
local path = system.pathForFile(“database.db”, system.ResourceDirectory)
db = sqlite3.open( path )
local function readDatabaseTest()
local t = “”
for row in db:nrows(“SELECT * FROM users”) do
local reading = row.id…" - "…row.column
t = " "…reading
end
return t
end[/lua] [import]uid: 53195 topic_id: 33539 reply_id: 133292[/import]
Exactly as @alfgogo says, you need to implement some sort of saving method into almost every app. If the app closes (permanently closes, not just “sleeps”), you’ll lose all local data. So, you need some method to save game state to a text file or SQLite database located in the app’s Documents directory. Then when the user returns at any time, you read the info and make changes to a scene… that might be a high score, which levels are unlocked, the custom volume level the user has chosen, etc.
Take a look here: Peach has created a nice module to save/load data:
http://corona.techority.com/2012/01/22/easy-level-unlocking-with-ego/
Brent [import]uid: 200026 topic_id: 33539 reply_id: 133324[/import]
Hi @agollnick1
I am sad to hear you said you sad.
Because this is consider ‘easy way’.
Try to do the same thing using other language/SDK, will take you longer learning time.
Be patient, you will master it in no time.
Happy coding!
[import]uid: 31508 topic_id: 33539 reply_id: 133330[/import]
I don’t have a twitter so i can’t get it
It looks complex from what I see in the comments. [import]uid: 184688 topic_id: 33539 reply_id: 133379[/import]
Corona is pretty much the easiest it gets if you want quality. Anyways, this is actually pretty easy, just make a SQLite database or txt file and play with the code I pasted, or use the Peach tutorial. It’s really nothing compared to the rest of programming you’ll have to do if you’re making a game, which is still pretty simple with Corona [import]uid: 53195 topic_id: 33539 reply_id: 133388[/import]
I don’t have a twitter so i can’t get it. [import]uid: 184688 topic_id: 33539 reply_id: 133392[/import]