Skip to main content
gamedev.net
🔒 Locked

Noobie Problem

Started by EclipseLearner 3 replies 800+ views
Original Post
EclipseLearner
EclipseLearner
Hey guys I have just started programming in Eclipse 3.2 and have run into a couple of annoying little problems. I have a problem of making movements using key strokes, i want to hit spacebar for a single movement (currently click a button and it just runs untill the end of the game). I also dont know how to add images to a game, i have a few .gif's ready to use but dont know how to animate them. I am new to this webpage and see no way of adding attachments so i cant show you what i am working with. Any help on these issues will be greatly appreciated. Thanks for reading
Bob Janova
Bob Janova
You can hook to keyboard events in Java by using addKeyListener (or similar) on the main form.

As for animating GIFs in Java, Google is probably your friend there. I don't know how many Java guys we have here on GameDev, and it's a reference question as opposed to a 'how to' question really. (And no, I'm not a Java guy either, and I don't know, sorry!)
rasher_b2
rasher_b2
In java I found the best approach for making animations in games using images was to make a class to do it. Basically, you give the class the images for the animation (each frame should be a sepeate image) and the amount of frames per second you want (ie. how long each image should be displayed on screen). The class will then display each image for the requested amount of time giving you your animation.
EclipseLearner
EclipseLearner
Thanks guys lots of help i've got the info i needed now cheers.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.