Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-25-2008, 12:53 AM
Member
 
Join Date: Dec 2007
Posts: 10
quickfingers is on a distinguished road
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)
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-23-2008, 07:18 PM
Nicholas Jordan's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Southwest
Posts: 421
Nicholas Jordan is on a distinguished road
A place to start.
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; } }
// This is ineffective - always checking is something one
// 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 07:21 PM. Reason: note errors in code
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Asking for password from a Servlet Java Tip Java Tips 0 01-27-2008 09:05 PM
add password to folder ismailsaleh AWT / Swing 1 01-08-2008 06:46 AM
Problem with a password saytri New To Java 2 12-27-2007 12:06 PM
Help, created a username and password box cachi AWT / Swing 1 08-07-2007 05:21 AM
Help with password matches Albert AWT / Swing 1 07-10-2007 05:17 PM


All times are GMT +3. The time now is 03:45 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org