Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Examples: Monday, today, last week, Mar 26, 3/26/04
Welcome home! Please contact lincoln@icrontic.com if you have any difficulty logging in or using the site. New registrations must be manually approved which may take several days. Can't log in? Try clearing your browser's cookies.

Wanna learn Java and/or make Java games? Heard of "Greenfoot"?

ToraldrisToraldris   -`-,-{@     Zen Nud... Buddhist     @}-,-`-  East Coast, USA Veteran
edited August 2014 in General Banter

I've been learning Java from scratch (boring text, sniff) for some time, but I recently found a resource that lets you start with a 2D graphical environment in which you can place objects and use, in many cases, built-in methods to manipulate the behavior of those objects and create games easily (w00t!). It's not just about creating the games, of course... it's also a fun way to learn Java programming. And it's free! (and, AFAIK, available for Windows, Linux and MacOS.)

The program is called "Greenfoot" (http://www.greenfoot.org). I've been following along with a tutorial on that site called the "Joy of Code", available at http://blogs.kent.ac.uk/mik/category/joy-of-code (I'm up to Lesson 13). This is the most enjoyable way of learning Java and creating games that I've discovered.

http://www.greenfoot.org/overview

(And no, things don't have to conform to a grid! That's just a starting example. You can also change the size of the world, and make objects move in any direction/angle from as little as a single pixel at a time.)

If anyone wants to learn with me, and discuss what they're doing, that'd be awesome. :D I'm definitely going to be making some simple games soon, and there's a Share/Export capability in the software that lets you package your app as an executable .jar file that will run on any system that has the Java Runtime Environment (including smartphones and tablets). It also lets you actually share your projects with others on the Greenfoot website (much like the program "Scratch" which uses pseudocode "blocks" instead of a real programming language).

Comments

  • federicafederica Seeker of the clear blue sky... Its better to remain silent and be thought a fool, than to speak out and remove all doubt Moderator

    OK, let me just say, if this thread should ever need Moderating, call @Linc because I already don't understand a single word. Except 'the'. I got 'the. And 'to'. I understood that as well....'in'...yup, I see that.....

    ToraldrismmoDaltheJigsaw
  • ToraldrisToraldris   -`-,-{@     Zen Nud... Buddhist     @}-,-`-   East Coast, USA Veteran
    edited August 2014

    @federica Yeah I was worried about that, you know how programmers love to cause trouble... :D  

    Hey I bet you could learn how to make simple games yourself, no joke. This Joy of Code tutorial explains it pretty much at the level of older children who don't know programming (so anyone can pick it up), and it teaches by doing and showing what actually happens to the objects. So if you ever want to try and learn Greek... ;)  

  • DairyLamaDairyLama Veteran Veteran

    Wasn't Java near where that volcano blew up? :p

  • ToraldrisToraldris   -`-,-{@     Zen Nud... Buddhist     @}-,-`-   East Coast, USA Veteran
    edited August 2014

    @SpinyNorman That I don't know. What I do know is Java was near where that MineCraft blew up... :cool:  

    I'm sure I'll never be able to make anything that's as cool as MineCraft, at least as far as my niece and nephew are concerned, but I'll try my best to make something great in 2D.

  • federicafederica Seeker of the clear blue sky... Its better to remain silent and be thought a fool, than to speak out and remove all doubt Moderator

    Well, I'm glad, @Aldris Torvalds.... But I think I'll just keep on with my knitting.... Mind you, some of the instructions in a pattern would make your eyes hurt....!

    "Cast on 82 sts. Work k2,p2 rib for 2 in. * k8, inc, rep from * to end of row ending k4. Work in patt as est for [#] sts, work 6 sts from chart A, work in patt as est for [#] sts, work 6 sts from chart B, work in patt to end of row."

    Got it? Good! It will look great once it's finished!! :lol: .

  • BunksBunks Australia Veteran
  • ToraldrisToraldris   -`-,-{@     Zen Nud... Buddhist     @}-,-`-   East Coast, USA Veteran
    edited August 2014

    It's already getting to be fun. :) Here's a sample of something simple that's part something-from-the-tutorial, part personal innovation. You click on the canvas and a group of circles and squares with random speeds, colors and directions pops into existence where your mouse pointer is... and they proceed to bounce off the walls. Each of them quickly fade out within 5-6 seconds, but the counter keeps track of the ones that are still around. It's difficult to get many on the screen, and my father was overly impressed with this simple display.

    The instructions disappear when you click Run, and reappear when you click Reset. I can't upload the JAR file here (the actual "game"), but if anyone wants it just PM me and maybe I'll send it via email or something. The screenshots can't convey the action.

    EDIT: I made the text/number in the counter larger, which makes it look bold, so it's easier to read! You can tell the difference between the first screenshot and the second (I only replaced the second).

  • VictoriousVictorious Grim Veteran

    @federica said:
    Well, I'm glad, Aldris Torvalds.... But I think I'll just keep on with my knitting.... Mind you, some of the instructions in a pattern would make your eyes hurt....!

    Got it? Good! It will look great once it's finished!! :lol: .

    I think that code actually runs the traffic lights in some places I have been.

  • ToraldrisToraldris   -`-,-{@     Zen Nud... Buddhist     @}-,-`-   East Coast, USA Veteran
    edited August 2014

    @Victorious Thanks for the inspiration! Traffic lights... I can make a game that has one or more traffic lights, and program accordingly. :D Maybe just one big traffic light that lets you know if you're safe to move, and you have to watch out for when it turns yellow and then red. The possibilities, oh the possibilities, are endless!

  • VictoriousVictorious Grim Veteran
    edited August 2014

    I did that in BASIC once. :) . Yepp thats how old I am.

    :coffee: .

  • ToraldrisToraldris   -`-,-{@     Zen Nud... Buddhist     @}-,-`-   East Coast, USA Veteran
    edited August 2014

    @Victorious‌ Don't feel bad, I used to program on a Commodore 64 and VIC-20 back in the day! I still remember how long it would take to save and load information from a tape drive; that was nuts! It's been so long that I've forgotten BASIC entirely. I'm actually surprised it's still around in the form of Visual BASIC, but I don't know anyone who uses it.

    My "modern" choices for learning programming have been C++, C#, Python and Java (and I've finally decided Java is the way to go, being the most universal while still resembling C++). BASIC never even entered my mind as an option. ;)  

    There's a program called "Scratch" that I've used (by MIT) that lets you write graphical games and applications without any programming language at all -- it just uses the programming concepts such as individual statements, methods, variables, loops... and lets you click them together (they are "blocks") to write functional code. Then you can import graphics and sounds. That's one method of learning code, but you'd then have to go and actually learn a real programming language. The programs you create in Scratch have to be run in a web browser from the Scratch website, or offline using the Scratch application itself. So, not that viable for creating games that anyone can play off the 'net.

    Greenfoot is the halfway point, making it easy to learn Java but also translating directly into Java programs and games. Everything you make in the program is either a class or an object of a class, and all of the code that you write is real Java code. All it really is doing is providing easy access to graphics and sound (which is more complicated than most beginners are comfortable with). The tutorials are also great.

  • VictoriousVictorious Grim Veteran

    It's been so long that I've forgotten BASIC entirely. I'm actually surprised it's still around in the form of Visual BASIC, but I don't know anyone who uses it.

    I have VB6 and not that long ago... sigh.
    And now I am writing in VB.net. :) .

    Java is pretty nifty. That is what I have been into the most. And then some Delphi 7.

    Python is too darn hard but some do love it. I have only been dabbling in it for scripting.

    I have looked into C, C++ and C# but never used it other than in labs.

    Greenfoot and Scratch sounds very interesting. I'll have a look at that.

    Cheers.

  • ToraldrisToraldris   -`-,-{@     Zen Nud... Buddhist     @}-,-`-   East Coast, USA Veteran
    edited August 2014

    @Victorious said:
    Python is too darn hard but some do love it. I have only been dabbling in it for scripting.

    I considered it, even following a web tutorial for a while, but in the end it came down to portability. You can't run Python apps if you don't have Python installed on your system, and most people don't. I've had some issues with the Python language itself (esp. that it's purely interpreted, allowing for code theft/plagiarism), but they are really secondary.

    So many programs rely on Java that practically everyone already has it. That's a big "pro". Even if they don't have it, they probably have at least heard of it. ;)  

    @Victorious said:
    Greenfoot and Scratch sounds very interesting. I'll have a look at that.

    Cool cool cool. Let me know how it works out for you. :D  

  • mmommo Veteran

    I think you could subscribe to some online learning site, like pluralsight

    it will be quicker to pick up things

    beta.pluralsight.com/

  • ToraldrisToraldris   -`-,-{@     Zen Nud... Buddhist     @}-,-`-   East Coast, USA Veteran
    edited August 2014

    @mmo Did you mean me, or Victorious? Also that site's not free. There is a free course at Udacity for learning Java (you "Audit Course" for all you need, but with no teacher support), but it's covering the basics in textual programming instead of starting graphically like Greenfoot (also free). And when you say "it will be quicker to pick things up", how are you judging that? I've tried several sites that purport to teach programming languages, and they often are just profiteers out to make a buck. The sites that have free courses, like Udacity and EdX and Coursera, have to try harder to make the courses worthwhile or no one will take them.

  • mmommo Veteran

    @AldrisTorvalds‌, I am both of you, if you are interested. :D

    Yes it is paid one. Thanks for pointing out Greenfoot and Udacity. I also know some a website where you can learn with no fee subscription. It is not just Java, it covers a lot of subjects.

    https://coursera.org/

  • ToraldrisToraldris   -`-,-{@     Zen Nud... Buddhist     @}-,-`-   East Coast, USA Veteran
    edited August 2014

    @mmo Yes I've taken Coursera courses in the past, they're awesome. EdX has less of a variety, and Udacity still less, but they all seem to be great courses to take. Udacity can teach you how to program your own search engine and web browser... but in Python. That's the part that made me sad, though I did go through part of it. :-/  

  • mmommo Veteran

    True. Coursera courses are great, although they sometimes make me feel like being experimented. But still really good. Edx is also nice. :)

  • ToraldrisToraldris   -`-,-{@     Zen Nud... Buddhist     @}-,-`-   East Coast, USA Veteran

    There's another site, other than those three (and Greenfoot), that I'd recommend: Codecademy. You can learn JavaScript, HTML & CSS, Python, Ruby and more. I only wish they had added Java, because it's a lot more interactive than some other sites!

  • mmommo Veteran

    Cool. :) But why do you choose Java? Why not C#?

  • ToraldrisToraldris   -`-,-{@     Zen Nud... Buddhist     @}-,-`-   East Coast, USA Veteran

    EdX also seems to have a Java course you can audit, though I don't think it did the last time I checked: https://www.edx.org/course/hkustx/hkustx-comp102x-introduction-computing-1690

  • ToraldrisToraldris   -`-,-{@     Zen Nud... Buddhist     @}-,-`-   East Coast, USA Veteran
    edited August 2014

    @mmo said: Cool. But why do you choose Java? Why not C#?

    @mmo Java will play on any system without having to port it. It'll play on a Windows machine, a Linux machine, a Mac... my nephew and niece's tablet PCs... my family's smartphones... and it's really easy to learn with Greenfoot, to make games and such. C++ was my language of choice for many years, but Java has won out. It's even in similar style to C++ to write Java code.

    It's not as speedy as C++/C#, but that's okay. The pros outweigh the cons in my case.

    mmo
  • mmommo Veteran

    There are also some universities with own websites covering different subject area.

    ocw.mit.edu/index.htm

  • ToraldrisToraldris   -`-,-{@     Zen Nud... Buddhist     @}-,-`-   East Coast, USA Veteran
    edited August 2014

    Yes MIT OpenCourseWare, I forgot about that one, thanks.

  • ToraldrisToraldris   -`-,-{@     Zen Nud... Buddhist     @}-,-`-   East Coast, USA Veteran
    edited August 2014

    The most awesome thing right now is that I haven't even completed the Joy of Coding tutorials, and I already know enough to make Pac-Man from scratch (using Greenfoot anyway; that's an advantage). Since I posted this thread the day after I started, it's only been about a week.:D Booyah, says I, booyah! Sound and everything. :)  

    My idea is to make a Pac-Man where instead of ghosts, you have capital letters. You have to eat those letters in the correct order to spell a word (provided at the bottom), and if you get a wrong letter... the rest of the letters turn on you (and literally turn red) and you have to avoid them for a while until they calm down. It's going to be to help my niece and nephew with their spelling, and I could program a lot of words into it. So NO ONE STEAL MY IDEA. This post is proof that I came up with it first, not that any of you fine ladies and gents would steal it. ;):D  

  • ChazChaz The Remarkable Chaz Anywhere, Everywhere & Nowhere Veteran
    edited August 2014

    @AldrisTorvalds said:

    My idea is to make a Pac-Man where

    That could get you sued if you ever tried to capitalize, but go ahead and build it anyway. It'll be fun. I wish I had the time/energy to do something like that. I spend my whole day writing code and I find it hard get into doing the same thing at home.

    And the best way to learn a new programming language is to get paid to learn it.

  • ToraldrisToraldris   -`-,-{@     Zen Nud... Buddhist     @}-,-`-   East Coast, USA Veteran
    edited August 2014

    @Chaz Yeah I'd have to make something vaguely similar, and I certainly wouldn't call it Pac-Man anything. It's really the fact that I have the know-how to do it that excites me, because it's been almost no time since I started learning. I've actually started building a game that won't resemble Pac-Man, but it will having letters moving around sorta like the ghosts in Pac-Man, and definitely a labyrinth. I've already completed the movement system (stop and pivot points) and score counter. It won't be difficult to create an autopilot method for the letters to move around randomly.

    My goal is to have an array of words (strings) that will be chosen randomly when the game is run, and will be displayed at the bottom. As you "catch" each letter in order, that letter changes color at the bottom (or gets a strikethrough, I'm not sure what I'm doing yet). If you get the wrong letter, the others will become aggro for about 15 seconds (or so), and speed up... making you need to run away from them, lest they catch you and you die (having to start over, or maybe on an optional "easy" setting it would just lose you one letter!). It may not be as hardcore as requiring someone to spell a word from memory, but the necessity of getting the letters in order might help lodge the spelling in memory. I can always do something else later, such as another version that has the words spoken to the player instead of displayed.

    It'll still be a fun game before anything else, but I'm not trying to just create pure entertainment... I want it to be educational. ;) I'm working on it first and foremost for family.

  • ToraldrisToraldris   -`-,-{@     Zen Nud... Buddhist     @}-,-`-   East Coast, USA Veteran

    What would be nice, and I'd be happy to do, would be to create a Buddhist-themed game. Unfortunately my own imagination is quite limited; it's my technical side that has the edge, but without ideas it goes to waste. If anyone has an idea for a simple 2D game, I may take that up as an additional project for forum members and likely free public release (I'm getting way ahead of myself, but that would be the idea going in).

  • VictoriousVictorious Grim Veteran

    @AldrisTorvalds said:
    What would be nice, and I'd be happy to do, would be to create a Buddhist-themed game. Unfortunately my own imagination is quite limited; it's my technical side that has the edge, but without ideas it goes to waste. If anyone has an idea for a simple 2D game, I may take that up as an additional project for forum members and likely free public release (I'm getting way ahead of myself, but that would be the idea going in).

    I have been thinking about a Sci-Fi book with a buddhist theme... But I agree it is pretty difficult.

    Very good learning links! Thanks.

    /Victor

  • ChazChaz The Remarkable Chaz Anywhere, Everywhere & Nowhere Veteran

    ^^ It's already been done, after a fashion.

    "Lord of Light" by Rodger Zelazny

    I've thought of writing something called Spartacus - Zombie Killer

    Is "killing" a zombie bad Karma?

    Victorious
  • VictoriousVictorious Grim Veteran
    edited August 2014

    @Chaz said:
    ^^ It's already been done, after a fashion.

    "Lord of Light" by Rodger Zelazny

    I've thought of writing something called Spartacus - Zombie Killer

    Is "killing" a zombie bad Karma?

    Not that spaced out ...

  • VastmindVastmind Memphis, TN Veteran

Sign In or Register to comment.