Jeffige

Member
  • Content count

    23
  • Joined

  • Last visited

Community Reputation

113 Neutral

About Jeffige

  • Rank
    Member
  1. code for a 2d java game?

    [quote name='David.M' timestamp='1345179047' post='4970423'] If you're just starting Java then I would pick up a book to learn the basics of the language. [/quote] Wow! Thanks David. That is more & concise info that I have read in one spot. Actually, after searching a couple of weeks for a good starting java book, I eneded up with java, A beginners guide 5th edition. I have read, although I do not need to know complete java, I do need to know the core. After that, I can start on Android while still learning java. As for frameworks & libraries, No Idea! I have not gotten to that intersection, yet. I do know that I only want to create simple 2D games like Tetris, Space invaders, Tumbl on Android, and some simple kid games like where they snap the puzzle pieces into place and an ABC learning game. On one of the posts here at gamedev.net I read someone mentioned this (sorry I have forgotten who exactly) A complete understanding of the basics would be desirable. Specifically the following topics: •Declarations and Access Control •ObjectOrientation •Assignments •Operators •Flow Control, Exceptions, and Assertions •Strings, I/O, Formatting, and Parsing •Generics and Collections •InnerClasses •Threads I know even a simple 2D game is a lot of work for a beginner. So, I'm taking it one line of code at a time. Thanks for the replies.
  2. code for a 2d java game?

    Thanks guys. David M, as of now, I just started to learn java (any programming for that matter) a few weeks ago. Self teaching/ learning with java, A beginners guide 5th ed. So, framework or engine? Couldn't tell ya. I was just thinking if I looked over the code from an actual 2D java game, it may help me to understand as I learn along. As for Android, that is my ultimate goal. Again, thanks for the help.
  3. code for a 2d java game?

    I have started to learn java so I could create 2D games for Android. Out of curiosity, does anyone know where I could find a simple open source 2D game so I could look over the code? It may help ( even if I don't fully understand it, yet) to actually see code and how it was written out. A side scrolling game would be perfect since that is what I am aiming for. But, beggars can't be choosy. Thanks for any recommendations.
  4. count++ & infinite loop

    [quote name='RulerOfNothing' timestamp='1345092384' post='4970057'] Another thing, if you put a semicolon after a loop statement it turns the loop into a empty loop (since the semicolon by itself is simply the null statement). To fix this problem you need to get rid of the semicolon after the for statement (but only after the for statement). [/quote] Yeah I just got that as you posted. Thanks Ruler
  5. count++ & infinite loop

    Um... nevermind. I guess this is why you should check the code first! [b][color="#006699"]for[/color][/b] [color="#000000"](count = [/color][color="#009900"]0[/color][color="#000000"]; count < [/color][color="#009900"]5[/color][color="#000000"]; count = count + [/color][color="#009900"]1[/color][color="#000000"]); <<<<<semicolon - that's why it didn't work. sorry guys.[/color] [quote name='jefferytitan' timestamp='1345091194' post='4970050'] It's just [i]count++[/i], not [i]count=count++[/i]. It's not better programming per se, just shorter. I don't use it the way you have, but if I recall correctly the return value of [i]count++[/i] is count, whereas the return value of [i]++count[/i] is count+1. It makes more sense as below: [source lang="java"]int count = 0; count++; // count is 1 after this ++count; // count is 2 after this int a = count++; // a is 2, count is 3 after this int b = ++count; // b is 4, count is 4 after this [/source] [/quote] So would that be more relevant, er... a better writing of that code? I just don't want to get into the habit of writing code people may frown upon.
  6. count++ & infinite loop

    When I write: [source lang="java"]for (count = 0; count < 5; count++);[/source] it gives me: [size="2"]This is count: 5[/size] [size="2"]From what the author says it's suppose to display the exact loop as the first example:[/size] [source lang="java"] for (count = 0; count < 5; count = count +1);[/source] thanks again.
  7. count++ & infinite loop

    Working through java, a beginners guide 5th ed one of the examples: [source lang="java"]public class forDemo { // Demonstrates the for loop public static void main(String[] args) { // TODO Auto-generated method stub int count; for (count = 0; count < 5; count = count + 1); System.out.println( "This is count: " + count); System.out.println( "Done!"); } }[/source] The author goes on to say that the example is not good programming and that you will not see programmers use that example, you would probably se this instead: count++. But when I run it with the latter: [source lang="java"] public class forDemo { // Demonstrates the for loop public static void main(String[] args) { // TODO Auto-generated method stub int count; for (count = 0; count < 5; count = count++); System.out.println( "This is count: " + count); System.out.println( "Done!"); } } [/source] it runs "this is count: 0 infinitely thanks for any help.
  8. Eclipse only shows java EE not java SE

    Man, thank you! I couldn't figure it out. I can't believe it was something so simple. Thanks for the help. If you don't mind: When I start a new java>project - src>new class, how can I keep the add [source lang="java"]public static void main(String[] args)[/source] so I don't have to check it every time? Thanks for the help.
  9. When I open Eclipse in the upper right hand corner it only shows java EE, not java SE & it only gives me the option to start a java EE project not a java SE one. I had to re-download and install eclipse. Be for i had a problem and had to uninstall it would allow me to start a new java SE project. Can any help me get coding again? Thank you for any help.
  10. I am following along with HeadFirst java. Got the path(s) correct, checked to make sure java was installed correctly with javac. I created a folder in: C:\Users\JEFFD\headfirst. Changed dir to C:\Users\JEFFD\headfirst. When I try and run javac MyVeryFirstApp.java, the dos window pauses for a half a second and returns with C:\Users\JEFFD\headfirst. [CODE] public class MyVeryFirstApp { public static void main (String [] args) { System.out.println( "I Rule!"); System.out.println("The World!"); } } [/CODE] thanks for any help.
  11. Think java exercise answers

    Any one care to help me understanding this? I found what is supposed to be the answer but I can't wrap my head around it. Like where did the 3600 come from on this line seconds_since_midnight = hour * 3600 + minute * 60 + second; Thanks for any help [source lang="java"]public class time { public static void main(String[] args) { int hour, minute, second, seconds_since_midnight, seconds_remaining, percentage_passed; hour = 20; minute = 14; second = 29; seconds_since_midnight = hour * 3600 + minute * 60 + second; System.out.print("Seconds since midnight: "); System.out.println(seconds_since_midnight); seconds_remaining = (24 - hour) * 3600 + (60 - minute) * 60 + (60 - second); System.out.print("Seconds remaining in the day: "); System.out.println(seconds_remaining); percentage_passed = seconds_since_midnight * 100 / (3600 * 24); System.out.print("Percentage of the day that has passed: "); System.out.println(percentage_passed); } }[/source]
  12. Think java exercise answers

    Does anyone know if there are any answers floating around to the exercises in Think Java: Think like a computer scientist by Allen Downey? I'm stuck on exercise 2.11 - the 24 hour clock. Thanks for any replies
  13. Eclipse start up preferences

    I am trying to find out how to start Eclipse Juno with a blank workspace when I start a new java proj. i.e when you start a new project it shows [source lang="java"]public class HelloWorl { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("Hello XDA!"); } } [/source] I would like to start with a blank workspace and write everything from scratch myself instead of Eclipse starting with [source lang="java"]public class GameDevExample { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub } }[/source] since most tutorials have you write the code starting from the opening lines. Also, is it possible to start with a blank project or no project at all when Eclipse Juno starts? Right now, it starts with the last project. I've tried looking through eclipse preferences and spent about 30 minutes on google trying to find the answer, but no luck. Can anyone help? Thanks for any help given.
  14. swing or not to swing

    Thanks for the replies. Since I'm just starting out, I don't want to be overwhelmed with learning too many different things at once. I'll just be the tortoise. Not really looking to win the race, just to have fun running it. (yeah, I don't know where that came from) Anyway, I'll just walk through the tutorials that I have, yes 1 of them does include a short tutorial on swing. But, it seems to go hand in hand with the rest. Thanks, again.
  15. swing or not to swing

    I was copying a couple of tutorials at zetcode.com [url="http://zetcode.com/tutorials/java2dtutorial/"]http://zetcode.com/t...java2dtutorial/[/url] [url="http://zetcode.com/tutorials/javagamestutorial/"]http://zetcode.com/t...agamestutorial/[/url] to turn them into PDF's so I could read them while I travel and the site mentioned java swing. I have recently undergone the task to learn java programming as my first language. (please don't ask why java. The back and forth from other posts left me loopy). I will hopefully be making simple apps and/ or 2D games for both PC & Android. So, do I need or should I learn java swing? Thanks for any help and enlightenment.