Results 1 to 2 of 2
  1. #1
    Kaytes is offline Member
    Join Date
    Apr 2012
    Posts
    1
    Rep Power
    0

    Default Why. Does. This. Not. Work.

    So, I'm self-teaching myself Java, for about three months now. For this program, I'm using objectdraw for the visual elements. Java and objectdraw are both latest versions. This program is a casting simulator in the style of Magicka, where you can combine elements. What I'm trying to have it do is display the spell type (AoE or bolt) first, and then two possible elements. ie; "A bolt of ice and water" or "An area attack of electricity and arcane power." However, it's displaying as "A bolt of ice.ice and water.water and". This is because in onMousePress there is a series of ifs for each element. Java seems to be seeing the "second" boolean as true, though I know that it should be false by default, and I haven't declared it as true. This is really kicking my ass. Any help?

    [Java] CastingSys - Pastebin.com

    PS: Ignore the element1 and element2 Strings, they are for something later.

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,004
    Blog Entries
    7
    Rep Power
    20

    Default Re: Why. Does. This. Not. Work.

    In your code I see things such as:

    Java Code:
    if (second = true); ...
    if (third = false); ...
    Two remarks: the comparison for equality operator is ==, not = and those semi colons don't belong there; they introduce an empty statement.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. applet call dll work in Win2000 but not work in WinXP
    By manhcuongtin4 in forum Java Applets
    Replies: 1
    Last Post: 07-14-2011, 01:45 PM
  2. Getting SWT app to work on a different OS
    By Ravioli in forum SWT / JFace
    Replies: 0
    Last Post: 02-20-2011, 09:35 AM
  3. Cant seem to get this to work
    By nivekeleets in forum Java 2D
    Replies: 4
    Last Post: 11-13-2010, 07:09 PM
  4. Why won't this while loop work?
    By trueblue in forum New To Java
    Replies: 6
    Last Post: 05-23-2009, 08:10 PM
  5. how would i get this to work...?
    By deeadeed in forum New To Java
    Replies: 6
    Last Post: 12-06-2007, 02:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •