Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Need a skilled developer to quickly finish up a project
Started by johnwvu711 May 18 2013 05:55 AM

2 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

johnwvu711

[GLOBAL: userInfoPane.html]
johnwvu711
  • Observer

  • 2 posts
  • Corona SDK

Hello everyone,

 

I need a skilled corona developer to quickly finish up a project of mine.  It's 95% finished but I am having alot of trouble locking and unlocking levels.  I've spent a total of at least 50 hours on this alone just to figure it out but I can't get it to work after reading through all of the tutorials available in this site. I also need help getting rid of sounds and music from an options menu.  This is probably quick work for a skilled developer.  I am offering a good 3 digit pay for this short work.  Email me for more information and I can give you details at johnwvu711@aol.com 



[TOPIC: post.html]
#2

J. A. Whye

[GLOBAL: userInfoPane.html]
J. A. Whye
  • Corona Geek

  • 1,689 posts
  • Corona SDK

Wish I had the time, because unless you're doing something "weird" the level lock thing is fairly easy to implement. Where most people run into problems is thinking the problem is locking and unlocking a level, but that's not what you really want. 

 

You may not want to work on it any longer yourself, but I'm waiting for a download so I'll just keep typing... ;)

 

Look at this:

 

local level1Locked = false
local level2Locked = false
local level3Locked = true
local level4Locked = true

 

Can you tell me which levels are locked? Of course you can, Levels 3 and 4 are locked. You don't need anything else. The missing key is that you look at those "flags" to determine whether you allow a user to select that level or not -- there is no actual "locking" of a level.

 

Of course, we don't actually want a separate flag variable for each level, that's just to make it really visible as to what's happening. Instead, you'd create a table like this:

 

local levelLocked = { false, false, true, true }

 

The elements of that table correspond to the levels -- first element is whether level 1 is locked, last element is whether level 4 is locked, etc.

 

So now when you're putting up buttons where the player can select a level, your code looks something like this:

 

for x = 1, NumLevels do
   if levelLocked[x] then
      (put up a lock image)
   else
      (put up the button image so they can select this level)
   end
end

 

You don't have to worry about whether a "level is locked" because you never allow the user to choose one they shouldn't have access to.

 

What about when they finish Level 2 and now Level 3 should be unlocked? You change the "flag" in the table at the end of Level 2 -- when they win/finish the level just do this:

 

levelLocked[3] = false

 

You can just send them straight to the next level or, if they're going back to the level select screen, now the lock won't be on that level because the flag has been changed.

 

Actually, in that last line of code I did something you do NOT want to do -- I hardcoded the 3 in there. Instead, it makes more sense to create a global variable that holds the current level. Something like:

 

currLevel = 1 -- the starting level

 

Now when we finish one level and want to go to the next one we can do something like this:

 

currLevel = currLevel + 1
-- probably want to check here to see if they've done all levels
levelLocked[currLevel] = false
loadLevel(currLevel) -- now go load the next level to play

 

You can use something like GGData to save and load that levelLocked table so it's persistent across sessions.

 

Summary -- You don't lock and unlock levels, you set a true/false flag for each level and that tells you whether to allow the user to play it or not.



[TOPIC: post.html]
#3

seanDp32

[GLOBAL: userInfoPane.html]
seanDp32
  • Contributor

  • 168 posts
  • Corona SDK

what file would i put 

  1. local levelLocked = { false, false, true, true }

-- what file would i put   

 

 

  1. for x = 1, NumLevels do
  2.    if levelLocked[x] then
  3.       (put up a lock image)
  4.    else
  5.       (put up the button image so they can select this level)
  6.    end
  7. end
  8.  do i have to still put  storyboard.gotoScene("level1","fade",400)

 my code look like this 

 

function level_1 (event)
 
 if event.phase == "began"then 
 
 print "level01"
 
 
   for x = 1, NumLevels do
   if levelLocked[x] then
     print"(put up a lock image)"
   else
     print" (put up the button image so they can select this level)"
   end
end
 
 storyboard.gotoScene("level1","fade",400)
 
 end 
 end 

 

also in the exit scene for level  2 i put 

  1. levelLocked[3] = false

 

and i put in level 1 

 

currLevel = 1

 

 

 

and level one exit scene i put

 

  1. currLevel = currLevel + 1
  2. -- probably want to check here to see if they've done all levels
  3. levelLocked[currLevel] = false
  4. loadLevel(currLevel) -- now go load the next level to play

 

 

then  i want to start my GGdata  

 

 

what i am doing wrong i am clue less thanks   a million 




[topic_controls]
[/topic_controls]