Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / I am looking how to create a light puzzle.

Author
Message
Takis76
19
Years of Service
User Offline
Joined: 9th Apr 2005
Location: Greece
Posted: 15th Aug 2011 13:38
Hello ,

I am working on my game , and I am creating my portal.
My portals will be like stargate and I am trying to create one puzzle to make my portal open.

Do you remember the light puzzle. You are pressing some buttons and then these buttons lits up and makes one musical sound.
Everytime you are pressing some of the buttons in correct order then one more combination added appended.

I will explain better. I have one pannel with 8 buttons.
You are pressing for example the 1st button and after a while , the puzzle adds one more button at the end of the sequence and then you need to press 2 buttons with correct order.

The puzzle adds one more combination at the end randomly.

The panel lit with the button you need to press

1 , 2.

The player need to press button 1 and button 2 , after that another one button added appended in the sequence and I need to press in the correct order again.

1 , 2 , 5.

Everytime player will press the correct order in the puzzle , the puzzle becomes faster and the buttons lits faster and the sequence becomes longer , untill the player do not remember what to press. If one mistake will happen , you are loosing whole puzzle and you need start over.

Is the light puzzle. I am trying to do this with my portals.

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 15th Aug 2011 18:03
I'm thinking since there's only 8 buttons the easiest way would be with a string to store the sequence of right numbers. Like Answer$="125".

As the user presses the buttons the program checks the right answer using the value of MID$(). Like VAL(MID$(Answer$,CurrentSequence).

Takis76
19
Years of Service
User Offline
Joined: 9th Apr 2005
Location: Greece
Posted: 15th Aug 2011 21:21 Edited at: 15th Aug 2011 21:22
If I want to read a part of a string how do I do it?

For example if the sequence of buttons are from 1 to 8 and I have some string with "125812" how do I read one byte of this string?

For example if I want to read only the number 8 from the string?

Is there any command which I can seperate some string from other string?

Because I found one idea how to implement this.

I will have one string and each time I will add one number at the end of the string , but how do I read in the middle of the string.

Does mid$ reads or skips some string?

Thank you :o)
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 16th Aug 2011 10:13
MID$() in Darkbasic reads one character from the string. The syntax is like this: Return String=MID$(String,Value)

So to show the 4th character of the string you do this:


Now if you want to go through the entire string you can get the length of the string with the LEN() command and use a FOR/NEXT loop to go though each character in sequence.



But for what you want to do it's best to use just a variable for the current character in the string and only advance to the next character when the user gets the button right.

Takis76
19
Years of Service
User Offline
Joined: 9th Apr 2005
Location: Greece
Posted: 16th Aug 2011 23:39
Fantastic I made it , thank you very very much. You helped me a lot.
And my light puzzle is ready and I made it even better, when you are progressing , the runes lits faster.

Now I am looking how to make some earthquake effect. When the portal is near to open , some good earthquake affects it would be very nice and some special sound effect.

If someone have a good idea about how to create my effect in code?

Thank you.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 17th Aug 2011 12:05
Here's a site that has a free earthquake sound but it's under a Creative Commons Licence so the guy that made this sound needs to be given credit if you use it in your game (his name is Mike Koenig).

http://soundbible.com/suggest.php?q=earthquake&x=0&y=0

The old school method of making an earthquake like event is to just move the graphics around a little and back to their original positions.



Takis76
19
Years of Service
User Offline
Joined: 9th Apr 2005
Location: Greece
Posted: 18th Aug 2011 19:37
In fact I am looking and some screen shake effect.
Takis76
19
Years of Service
User Offline
Joined: 9th Apr 2005
Location: Greece
Posted: 19th Aug 2011 03:35 Edited at: 19th Aug 2011 03:39
Ok I finish something and I would like to show what I have created.

This mid$ command is fantastic and thank you very much for your help. Thank very much for all forum help.

http://www.commercial-center.com/eob4/Eye_of_the_Beholder_4_engine_v0.033.rar














Some vortex sounds are missing and some portal sprites will be improved in next versions.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 19th Aug 2011 08:00 Edited at: 19th Aug 2011 08:01
Np. I have to say after running the program that it's TOTALLY COOL. I loved playing all the Eye of the Beholders when they came out and still have a place in my heart for this type of game. My favorite of the genre was the Might and Magic series but I played a lot more SSI games than Might and Magic.

That sequence for going through the vortex looked a like it was from Stargate (which is another thing I love). Keep up the great work!

Login to post a reply

Server time is: 2024-11-24 01:32:41
Your offset time is: 2024-11-24 01:32:41