Results 1 to 2 of 2
Thread: Password System help
- 01-24-2008, 11:53 PM #1
Member
- Join Date
- Dec 2007
- Posts
- 21
- Rep Power
- 0
Password System help
Ok I am working on a game which I would like to add a password System too .
Here is what my screen looks like
U= Up Button
D= Down Button
#= number
// Just a guide for the picture
U U U U
# # # #
D D D D
Now this is what I want it to do
I want to make it so when you click the first Up arrow only the first number goes up or if you click the down arrow only the first # goes down
and the same thing for the other 3 Images I made
This is what I have done
I have it so the buttons change the correct int
Add MouseClicked Since I used KeyPressed
This is what I need
All I need now is to check if the password is correct when they place in the password
This was what I was trying
//init
password[0]="1024";
//in run so it always checking
if(password[0]==""+num1+num2+num3+num4)
- 06-23-2008, 06:18 PM #2
A place to start.
// This is ineffective - always checking is something oneJava Code:// Ok, very simple - for a game. No supercrunching or anything. // I suppose we could start like this: // A little complicated for a starter effort. class supercruncher { int[][] pwStore = new int[3][4]; supercruncher() { // conceptual - to be coded ..... // We can unroll the loop for simplicity. for(pwStore.length) = passwordAsInt; } // ..... other code here if(checkPassword(int suppliedValue)) { int loopControl = pwStore.length; do { // this next line is not correct if(pwStore.[--loopControl] == suppliedValue) { return true; } } while(loopControl > 0); return false; } }
// would place in the run loop in a game
if(password[0]==""+num1+num2+num3+num4)
Also, for four numbers - the way I have the array is incorrect. Several things in the code are indeterminate until you provide us some feedback....Last edited by Nicholas Jordan; 06-23-2008 at 06:21 PM. Reason: note errors in code
Similar Threads
-
Asking for password from a Servlet
By Java Tip in forum Java TipReplies: 0Last Post: 01-27-2008, 08:05 PM -
add password to folder
By ismailsaleh in forum AWT / SwingReplies: 1Last Post: 01-08-2008, 05:46 AM -
Problem with a password
By saytri in forum New To JavaReplies: 2Last Post: 12-27-2007, 11:06 AM -
Help, created a username and password box
By cachi in forum AWT / SwingReplies: 1Last Post: 08-07-2007, 04:21 AM -
Help with password matches
By Albert in forum AWT / SwingReplies: 1Last Post: 07-10-2007, 04:17 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks