Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (491)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (556)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2 3 4
  ignore  |  Print  
  2d game with libgdx where to start?  (Read 16474 times)
0 Members and 1 Guest are viewing this topic.
Offline hellrazer21

Junior Member





« Posted 2013-04-17 05:15:15 »

i want to make a 2d game with libgdx but im not sure where to start like what files to import and stuff

all i know is that i want to use tiled map editor tmx format maps

as far as sprites and controls i dont really know where to start

so far all i know is that gdx-setup-ui.jar can make the project folders but thats as far as i got

i tried running some example projects and i got nothing but errors and i tried following tutorials and their not exactly noob friendly  Emo Pointing

if someone could help me out i'd really appreciate it  Grin

Offline ReBirth
« Reply #1 - Posted 2013-04-17 05:24:20 »

http://code.google.com/p/libgdx/wiki/

And check the http://github.com/libgdx/libgdx, they have lot of test classes.

Offline HeroesGraveDev

JGO Kernel


Medals: 246
Projects: 11
Exp: 2 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #2 - Posted 2013-04-17 05:31:43 »

1. Programming isn't very n00b friendly. (But it is sometimes newbie friendly)
2. Google is your friend.
3. If asking for help, please be more specific. What errors were you getting?
4. Start small, then work your way up to bigger projects.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline hellrazer21

Junior Member





« Reply #3 - Posted 2013-04-17 06:23:16 »

i tried running the test/examples but when i import them i get a ton of errors like this (big list down below)

thats why i gave up on the examples...importing crap into eclipse seems like it chokes when i import too many files at once or something either way i rather just start working on my own game instead of trouble shooting other peoples example projects

people say libgdx is good so i might as well give it a shot and try to build a project from scratch but thats why im  here right now asking for some help

sorry i wasn't specific the first time but what i meant to ask was what backends/jars do i need, to get a 2d sidescroller started and where do i put those files(i assume the libs folder but im not 100% sure)?

do i need any other stuff before i can start coding ?

btw thanks for the quick replies guys  Cool


EDIT*
removed long list of errors

Offline ReBirth
« Reply #4 - Posted 2013-04-17 06:27:08 »

Forum:
Use pastebin for long paste, and use code tag for in-post code.

Libgdx:
Learn by reading wiki first. Understand the concept. Don't touch any code before you know how to setup libgdx projects. And after that, you better start from desktop first. Good luck Smiley

Offline hellrazer21

Junior Member





« Reply #5 - Posted 2013-04-17 06:38:07 »

yea i spent two days on the wiki going back and fourth i took a few notes but it all seems more like the guts of libgdx no so much the starting point

i know how to use the libgdx-setup-ui.jar thats about it
i was actually planning on going straight to andriod  i dont want to risk putting together a game for desktop then struggle to port it to android  i know with libgdx its supposed to be a pain free process but i rather just focus on my main target till i have a working prototype done

Offline ReBirth
« Reply #6 - Posted 2013-04-17 06:44:46 »

Then you may want to narrow down the use of classes. Have you known usage of TextureRegion, Stage, scene2d, Table, Screen, Game, InputListener, etc?

Offline hellrazer21

Junior Member





« Reply #7 - Posted 2013-04-17 07:00:39 »

do you mean like the basic features and things i want in the game? or something else?

Offline ReBirth
« Reply #8 - Posted 2013-04-17 07:20:49 »

Something like that.

Offline hellrazer21

Junior Member





« Reply #9 - Posted 2013-04-17 07:45:12 »

well i just want to get a very basic setup going

like haveing a map a chracter and the controls

so
sprites
controls
audio
collisions

maybe even particles buts thats later
particles(i couldn't make the particle editor run on my main computer but i tested it on my sisters computer when she wasn't home and it worked perfectly Shocked i'll probably figure that out later)

i know how to use tiled map editor and i know theres some info about it in the wiki i was going to start there but idk if i might need some backend files/jars before i start trying to render out the map

so first off getting a map on screen
then maybe the collision and tile properties


Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 128
Projects: 4
Exp: 3 years



« Reply #10 - Posted 2013-04-18 05:03:54 »

Instead of using the Sprite and Texture classes, I would recommend using the newer Stage/Actor classes (not in some of the tutorials, because they're newer) - they encourage better OOP design and make your code cleaner. Good example and basic tutorial here: https://code.google.com/p/steigert-libgdx/
Offline Nate

JGO Kernel


Medals: 145
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #11 - Posted 2013-04-18 10:37:31 »

Note that scene2d (and any scene graph) couples model and view. This is also true of Sprite. You can still make a fine game using them of course. Smiley

Offline ReBirth
« Reply #12 - Posted 2013-04-18 11:34:38 »

I always use combo of Stage and Image for entities.

Offline hellrazer21

Junior Member





« Reply #13 - Posted 2013-04-18 21:45:33 »

im getting kinda confused now some people tell me to use scene 2d then others people on other forums say not to use it and the wiki says its for UI but people say you can use it for the whole game  Huh

Offline ReBirth
« Reply #14 - Posted 2013-04-19 01:57:20 »

It's true that scene2d is used for UI. Your game still needs UI right? for menu there are buttons, label, and more on option screen. However for entity (your ship etc) you may want to use Image, Sprite, or your own (? extends Actor) homemade class.

Offline Nate

JGO Kernel


Medals: 145
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #15 - Posted 2013-04-19 07:18:14 »

scene2d is great for UIs, use it. Smiley For 2D games you can use scene2d or you can just use SpriteBatch. Using scene2d means you won't be able to do the MVC pattern easily, but otherwise it is fine. Some games likely benefit more from scene2d, such as board games (mahjong, match3, etc).

Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 128
Projects: 4
Exp: 3 years



« Reply #16 - Posted 2013-04-19 16:28:32 »

Does no one use TableLayout anymore? Considering switching to Scene2D/TWL (mostly TWL) but idk.
Offline Nate

JGO Kernel


Medals: 145
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #17 - Posted 2013-04-19 16:36:40 »

Everyone uses TableLayout, because it is absolutely awesome. Smiley Doing layout with anything else is pure hell.

Offline Cero
« Reply #18 - Posted 2013-04-19 21:11:29 »

Scene2D is yUp.  Problematic if you have a yDown mindset and legacy code.
Only using it for ui stuff. Also not using table layout yet just pixels. But I see the benefits. We'll see.

Offline hellrazer21

Junior Member





« Reply #19 - Posted 2013-04-20 04:08:18 »

ok so i'm going to be using scene 2d for the menu but sorry for asking such a dumb question but how can i transition from the splash screen to the menu screen?  Tongue im still a bit new to java and im not sure what i should be looking for in the api

Offline ReBirth
« Reply #20 - Posted 2013-04-20 11:18:53 »

If you extend Game class, then just call setScreen(). It'll call hide() on current screen, change reference, and call show() on new set screen. Your homework is make sure you do right thing on show(0 and hide().

On show() you'll of course just need to prepare the content. On hide(), if each of your Screen child classes have individual disposable classes, dispose them.

Offline Nate

JGO Kernel


Medals: 145
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #21 - Posted 2013-04-20 16:06:50 »

Scene2D is yUp.  Problematic if you have a yDown mindset and legacy code.
Only using it for ui stuff. Also not using table layout yet just pixels. But I see the benefits. We'll see.
When using tables you'll never have to do pixel math for layout, so you'll never even notice that things are y-up. Of course when rendering something inside an actor it is y-up.

Offline ReBirth
« Reply #22 - Posted 2013-04-21 02:34:06 »

On table I just adjust the align, expand, and number of rows Smiley

Offline hellrazer21

Junior Member





« Reply #23 - Posted 2013-04-22 00:17:41 »

can someone clear this up for me ... if im going to be displaying a splash screen then the menu  then the game/map (tmx file) 
do i need to use the assets manager for everything?
https://code.google.com/p/libgdx/wiki/AssetManager
scene2d for the UI/HUD and maybe screen transitions,
https://code.google.com/p/libgdx/wiki/scene2d
and the tween engine for screen transitions (unless theres a better option)
https://code.google.com/p/java-universal-tween-engine/

 is there a better way to display the splash screen cause right now all i did was slap my splash image in with the default code that comes with useing the setup-UI for libgdx

i bet theres a million different ways of displaying the splash screen but what would be the best way to go about it 

i seen some videos on youtube where people put the splash image in with the sprites and game images in texture packer and they load it up like that but idk if mixing it with the game sprites would be a good idea  Undecided

btw has anyone out there actually finished a 2d game?



Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 128
Projects: 4
Exp: 3 years



« Reply #24 - Posted 2013-04-22 01:57:24 »

You definitely don't have to use AssetManager, and I don't see any problems with putting the splash screen image in the texture atlas, however you should probably stick to Textures while you're developing your game to avoid the hassle of repacking your image all the time.
Offline ReBirth
« Reply #25 - Posted 2013-04-22 02:30:44 »

https://github.com/drabiter/magnet (REMEMBER, it's old version not the published one. You should keep downloading my game! arggh!)

No AssetManager, the game logic is pretty buggy but the structure is so F simple to understand Smiley

Offline hellrazer21

Junior Member





« Reply #26 - Posted 2013-04-23 06:11:07 »

@ Jimmt if i dont use assets manager i have to manually dispose of stuff right? so wouldn't it be better to use it

@rebirth i couldn't get your game to run i got two warnings  Clueless
Description   Resource   Path   Location   Type
The serializable class  does not declare a static final serialVersionUID field of type long   LRUCache.java   /Magnet/src/com/coffeefury/magnet/utils   line 29   Java Problem
Build path specifies execution environment JavaSE-1.6. There are no JREs installed in the workspace that are strictly compatible with this environment.    Magnet      Build path   JRE System Library Problem

@anyone who wants to reply
i managed to get a tiled map loaded on screen Grin
 but how do i set the collisions for tiles and spawn a character
and how can i activate/call another java file/method sorry i dont know the right terminology

Offline ReBirth
« Reply #27 - Posted 2013-04-23 06:15:39 »

Quote
Build path specifies execution environment JavaSE-1.6. There are no JREs installed in the workspace that are strictly compatible with this environment.
Are you sure there is 1.6 installed?

Offline hellrazer21

Junior Member





« Reply #28 - Posted 2013-04-23 19:25:30 »

i only have 1.7

C:\Users\cm>java -version
java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)

i tried installing Java SE Runtime Environment 6u43 cause theres no 1.6

only these

Java SE

 Java SE 7

 Java SE 6

 Java SE 5

 Java SE 1.4

 Java SE 1.3

 Java SE 1.2

 Java SE 1.1

Offline ReBirth
« Reply #29 - Posted 2013-04-24 01:46:06 »

That's odd. I compiled it with 1.7.

Mah, there's download link if you want to play the game but what most important is for you to learn from the code structure. It shouldn't have error on syntax/build, just runtime problem.

Pages: [1] 2 3 4
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Nickropheliac (15 views)
2014-08-31 22:59:12

TehJavaDev (23 views)
2014-08-28 18:26:30

CopyableCougar4 (33 views)
2014-08-22 19:31:30

atombrot (41 views)
2014-08-19 09:29:53

Tekkerue (40 views)
2014-08-16 06:45:27

Tekkerue (35 views)
2014-08-16 06:22:17

Tekkerue (25 views)
2014-08-16 06:20:21

Tekkerue (37 views)
2014-08-16 06:12:11

Rayexar (72 views)
2014-08-11 02:49:23

BurntPizza (49 views)
2014-08-09 21:09:32
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org 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‑gaming.org
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!