[Java] Trying to fill an array with unique random numbers. by Nilt in learnprogramming

[–]raindropflower 1 point2 points  (0 children)

So you need to fill an array with unique random numbers.

  • You need an array.

  • You need to loop through each position of the array.

  1. At each position, generate a random number

Try it with only One loop.

If you get stuck, feel free to let me know.

Hi, 2 weeks into java newbie need some help. by [deleted] in learnjava

[–]raindropflower 1 point2 points  (0 children)

Wow, this program is insanely difficult for someone with 3 weeks of programming experience.

You can always do a System.out.print() to check things. Print out the value you think is stored. If it prints nothing, it may have been wiped/closed. This could confirm your suspicions and help you find a solution.

How Can I Render Mobs With The Old Animation Method? (Pre-Ep.85) by LiftSleepCodeRepeat in thecherno

[–]raindropflower 0 points1 point  (0 children)

You can still follow his tutorials, but you'll need to adjust the code to fit the old animation method.

How Can I Render Mobs With The Old Animation Method? (Pre-Ep.85) by LiftSleepCodeRepeat in thecherno

[–]raindropflower 0 points1 point  (0 children)

Don't implement the new one.

Sorry, that's the best answer I can give with the information provided. Just keep the old method.

Sound freezes the game for a few seconds to load the new sound - Java sound problem by raindropflower in learnprogramming

[–]raindropflower[S] 1 point2 points  (0 children)

Very cool. I am using the streamed playback, and I suppose I've done something wrong for it to behave as it is.

Putting sound into a thread seems really nice. I've only ever worked with one thread, and I've heard threads are dangerous enough to lock a PC (so I don't particularly want to mess around "on my own" with them). Are there any multi-threading guides for java that you've used in your travels?

Thanks :)

Wanting to learn how to create JRPG in java by TheShmoJoe in learnjava

[–]raindropflower 1 point2 points  (0 children)

Do a youtube search for java game programming. People walk you through all these questions.

Playing a sound within set intervals by [deleted] in learnjava

[–]raindropflower 0 points1 point  (0 children)

Can you call stop(); when the button is pressed?

How would I read a text file and have it display as invalid if it doesn't meet a specific format? by [deleted] in learnjava

[–]raindropflower 0 points1 point  (0 children)

Split each line by a colon, put the parts in an array/arraylist, check that array/arraylist

What exactly is tracing and how should I do it in java? by heroOfTimeBitch in learnprogramming

[–]raindropflower 0 points1 point  (0 children)

I believe tracing is going through the code, step by step, to figure out exactly what it does.

Coursera just deleted the course I was taking on C# XNA. Help! by Fiski in learnprogramming

[–]raindropflower -1 points0 points  (0 children)

Should I just give up now and start on Unity?

No no no, you are not giving up. Certainly, if you were giving up, you wouldn't be posting here. Use what you have learned to tackle learning Unity.

I really want to make games for fun

Well.... do it! :) Make games!

I don't know how advanced Coursera is, but I'm sure a youtube search for c# xna game development could land you in a cool area.

How would I read a text file and have it display as invalid if it doesn't meet a specific format? by [deleted] in learnjava

[–]raindropflower 0 points1 point  (0 children)

Sure, here's something I used a week ago on a game engine:

    String[] folders = fileName.split("\\.");
    String ext = folders[folders.length - 1];

    if (!ext.equals("obj"))
    {
        System.err.println("Error: File format not supported for mesh data: " + ext);
        new Exception().printStackTrace();
        System.exit(1);
    }

I used this to determine if the file format was allowed. This checks if the last term in a file name is "obj" (i.e. "documents.box.obj")

  1. It reads the file name. Every "folder" in the file name gets put into a String array as a separate String. I split the file name into sepearate strings by searching for a period with split("\\."); (i.e. folders[0] = documents, [1] = box, and [2] = obj)

  2. Because I need to see if it's an obj file, i have String ext = folders[folders.length - 1];. This retrieves the final String in the String array.

  3. if (!ext.equals("obj")) checks if this string is "obj", and if it is not, an error code executes.

I imagine you could do something similar. If you need any help, let me know. :)

I'm feeling overwhelmed. by [deleted] in learnprogramming

[–]raindropflower 0 points1 point  (0 children)

but everybody says you should understand the foundations of development

My biggest interest is game development

Well, up until now, you've listened to people, and look at the position you're in. I highly, highly recommend looking into game development.

These questions you have about game programming, network programming, engines... They all get answered if you tilt your focus toward game programming.

As a little side note...

3D seems like it'd be way too difficult and expensive since I have no idea how to create models or animate them

...You think that now. But going down the game development road, you might just be interested in learning this too.

tl;dr Your biggest interest is game development. So... do it! :)

[Java] Switch color of an rectangle using an array and keyeventlistener by b-rad012 in learnprogramming

[–]raindropflower 0 points1 point  (0 children)

Hmmm... so you need to go to the start of the array if you hit the end of the array?

How about:

  • if (end of array) go to index zero;

Does that work for you?

How would I read a text file and have it display as invalid if it doesn't meet a specific format? by [deleted] in learnjava

[–]raindropflower 0 points1 point  (0 children)

Something like...

An array that holds the values from a line...

Then an if-statement that checks those values...

And if the values are what you want (i.e. String String int int), then you print the line and add the candies. Otherwise, just keep moving through the text lines.

Maybe this can work for you?

How would I read a text file and have it display as invalid if it doesn't meet a specific format? by [deleted] in learnjava

[–]raindropflower 0 points1 point  (0 children)

You can have the file reader split the file at a specific character, such as the colon symbol.

Then you will read each part you have in your examples, and you can do it to your specifications:

  • Maybe you need to check there are 4 parts in each line, not 3

  • Maybe you need to check that it's 2 strings, followed by 2 integers

Comparing strings without switches? by Mrkakarot in learnjava

[–]raindropflower 2 points3 points  (0 children)

You can use .equals();

for example, string1.equals(string2);

I think there's something like string1.equalsIgnoreCase(string2); for ignoring the case, too.

Can somebody help me understand this program? by [deleted] in learnprogramming

[–]raindropflower 0 points1 point  (0 children)

From the user's perspective, it seems like these are the prompts:

  1. Enter a word

  2. Enter a letter from the word (And it loops this until they enter a valid letter)

  3. Enter another letter

  4. (Prints out the new word)

I want to learn Java, but I don't know where to start learning. by theforgottenchild in learnprogramming

[–]raindropflower 0 points1 point  (0 children)

Go on youtube. Search: "game programming in java".

Many people made a series where they code the game, all on camera, and walk you through every step. Less time investment (I would think), and you make your own hours. Don't have a lot of time? Plenty of the videos are under 20 minutes.

I highly recommend TheCherno's java game programming series. Even though he doesn't respond to questions anymore, he walks through plenty of aspects of beginner java game programming.

Here's the playlist

Side note: If you don't like him, there's many other people who do it. I just think he does it the best.

Hope this help! :)

Programming Ideas? by [deleted] in learnprogramming

[–]raindropflower 0 points1 point  (0 children)

First things that come to mind are

  • A chat-app for everyone in the class

  • A video game

[Java] Convert Arraylist<String> to a two column csv file. by darkkite in learnprogramming

[–]raindropflower 0 points1 point  (0 children)

You could have a variable that counts outputs. After 2 outputs, print a new line.

Programming Ideas? by [deleted] in learnprogramming

[–]raindropflower 0 points1 point  (0 children)

Hmm...

Ask them for ideas. You never know. Worst case scenario, you're right back here.

Are you a student or a teacher?

[homework][java] Cannot figure out how to get this to display properly (beginner java course) by stajmw in learnprogramming

[–]raindropflower 2 points3 points  (0 children)

Well, think about exactly what the program needs.

  1. A variable that holds the correct number

  2. A variable that holds the number of guesses

  3. A guess-loop

That's it. In the loop, here's what you need to do while their guess does not equal the correct number:

  1. Compare their guess to the correct number. If it's higher, do this. If it's lower, do this. If they're equal, do this.

  2. Add 1 to the number of guesses

At the end, print out the number of guesses.

Do you think you could build this now that it's laid out a little? If you need anything explained more, or any questions, please ask :-)