x


GUI button sequence to open door (java)

I'm new to javascript and I'm trying to think of how to do this. Basically I want to click a sequence of buttons to unlock a door.

alt text

So upon entering the right combination it would set a boolean to true, allowing the player to enter the next area. I've seen some other ways to do a door key code, with using textfields and a variable "stringToEdit" but it doesn't really suit how my game plays.

Any help would be greatly appreciated.

keypad.jpg (96.2 kB)
more ▼

asked Aug 07, 2013 at 12:16 PM

imaethan gravatar image

imaethan
21 13 11 14

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

I'm just writing the algorithm. You should convert this to javascript.

Pass = "3462"

CorrectCount = 0

Succeed = false

Loop{

Key = Get pressed key

if Key = Pass[CorrectCount] CorrectCount else CorrectCount=0

if CorrectCount=Pass.Length{

Succeed=true

break loop

}

}

more ▼

answered Aug 07, 2013 at 02:11 PM

Xtro gravatar image

Xtro
2.8k 17 13 24

Were you able to test this ?

Aug 08, 2013 at 07:15 PM Xtro

Sorry, my PSU blew and I've not been able to get to a computer until now. I'm unsure how to go about converting this to java

Aug 17, 2013 at 10:42 AM imaethan

I'm sorry to say that but if you can't convert a simple algorithm into your programming language, you shouldn't be developing a game. You should be practicing your programming skills first. Please don't take me wrong. I'm just suggesting for your good.

Aug 17, 2013 at 12:43 PM Xtro

Yeah, I get you. Just trying to learn as I go I guess. Since I generally just make the environments, not aiming to be a programmer really. Just need some basics to make a small interactive environment.

Aug 17, 2013 at 01:14 PM imaethan

hmm I see. You are right.

Aug 17, 2013 at 01:22 PM Xtro
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x456
x288
x97
x8

asked: Aug 07, 2013 at 12:16 PM

Seen: 822 times

Last Updated: Aug 17, 2013 at 01:22 PM