Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Java 2D Fighting game  (Read 6667 times)
0 Members and 1 Guest are viewing this topic.
Offline Swattkidd7

Junior Devvie

Exp: 8 years

« Posted 2008-03-18 04:04:07 »

Ok well since i have about 120 views and no replies im guessing there is something wrong with my question.

Here is a more specific question i have, When doing animation would it be wise to have the player class have an Array of images for the right walking, and an array of images for the left walking, and then in the update function use another array called "currentArray" or w.e (which will be set when player is set to move right or left)..

Also, i seem to have trouble creating an Image array, i remember doing it before but cannot anymore. I feel like a noob but something like this isnt working.

Image[] anim = new Image[5]

anim[0] = insertWayToGetImage;
Offline Swattkidd7

Junior Devvie

Exp: 8 years

« Reply #1 - Posted 2008-03-18 04:38:40 »

Offline Swattkidd7

Junior Devvie

Exp: 8 years

« Reply #2 - Posted 2008-03-22 16:18:45 »

First post UPDATED.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline noblemaster

« JGO Spiffy Duke »

Medals: 35
Projects: 11

Age of Conquest makes your day!

« Reply #3 - Posted 2008-03-22 21:39:49 »

I would create two classes. One is the Player class that defines what your player is doing. For example:
enum Action {NA, LEFT, RIGHT, JUMP};

Then second, you have the PlayerSprite class which renders the player on the screen. You could do it as described: have an array of images for each type of actions:
Action action = player.getAction();
if (action == Action.LEFT) {
  // render correct image for left...

The Player class doesn't know anything about images. It just purely contains the player information. The PlayerSprite will need a timer to identify the correct image (in the series) to render it onto the screen.

Offline Coinerson

Junior Devvie

Introducing the world's cutest zombie, Timmy

« Reply #4 - Posted 2008-03-24 22:14:27 »

Your probably going to want to create an Animation class too otherwise its going to get very unwieldy.
Offline DMastaGX

Senior Newbie

« Reply #5 - Posted 2008-06-15 16:46:12 »

Make a Player Object that contains an Animation. and inside it have a Method that changes the Animation when a certain Button is pressed. Make sure all the Animations are loaded as soon as the program starts to run.
Pages: [1]
  ignore  |  Print  

EgonOlsen (45 views)
2018-06-10 19:43:48

EgonOlsen (27 views)
2018-06-10 19:43:44

EgonOlsen (47 views)
2018-06-10 19:43:20

DesertCoockie (210 views)
2018-05-13 18:23:11

nelsongames (127 views)
2018-04-24 18:15:36

nelsongames (126 views)
2018-04-24 18:14:32

ivj94 (867 views)
2018-03-24 14:47:39

ivj94 (128 views)
2018-03-24 14:46:31

ivj94 (779 views)
2018-03-24 14:43:53

Solater (143 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!