Java 2D OpenGL RPG Tutorial 2: Setting up the player

preview_player
Показать описание
In this video we finish our basic game engine and set up our player
Рекомендации по теме
Комментарии
Автор

no, never mind. it makes a bit more sense now.
absolutely love this series so much, so keep up the good work ;)

SamBrev
Автор

Hey. Great tutorial. Just wanted to let you know that you don't multiply by "delta" in your "getSpeed()" method in the player class, so if the fps drops it's now going to move slower, if it's more than it's going to move faster. Multiplying by delta solves this. Keep up the good work! ;)

PandaMoniumHUN
Автор

Great tutorials benny! Just started converting a Java application game to the lw engine, and your vids has been very helpful! keep it up!

kalleidoskop
Автор

Thanks for the tutorial thebennybox I like and understand you much more than a book or text tutorial. Sub!

abhishekgorti
Автор

It has already been said, but just to reinforce the idea using super instead of init in the player class is a far more straightforward approach (and usually how it is done).

The init approach makes it so that GameObject can only have 1 constructor, which may end up cornering you later.

johnathanmcnutt
Автор

25:01 - 25: 02
I believe I've got at least some of the explanation covered for ya, Benny.
To all who wonder about how it would be useful, here are a few ways:

1) Walking speed
2) Attack speed
3) HP/MP/FP recovery speed
4) HP/MP/FP drain speed

Things like this. Also, feel free to suggest more. I'd love to see what others watching out there can come up with. Good day, sir.

ScruffyHalflingFilms
Автор

Okay, this criticism needs to be raised: You shouldn't be calling the Sprite spr. It's not clear what spr means. You should at least be calling it sprite.

Your init method in GameObject would be better handled as a constructor that you'd call such as super(x, y, r, g, b, sx, sy); as the first line in the GameObject subclass constructors.

I can also think of very good reasons why you would not want to calculate level, or max health, or any of that.

seigeengine
Автор

XD thanks so much, but let me just quote you at the 30:50 minute mark: "As weird as that sounds, your level can be a floating point value even though that makes so little sense I am going to change it right now."

IAmTehAg
Автор

oh, hi benny, love the series. but i still think it's a bit strange. besides, in the next part (spoiler, if anyone hasnt seen it yet), you make an ultra high precision level system with doubles, and then you cast it as an integer. the way you switch from doubles to integers does confuse me.

SamBrev
Автор

Yeah, this guy is tight. I guess that what you get when you're a c++ coder.

trueredexe
Автор

in 17:00 Can I just create constructor in GameObject class and use "super" in Player class?

smerfbukkit
Автор

find my post on this page, i had the same problem..the problem isnt the box not rendering, its that its off screen. inside the Game() constructor, where it says Player.SIZE / 2 , remove the /2 in both parameters. At least that was the problem for me. Or try changing the points inside the Sprite class where the staring vertex is drawn at. Hope this helps! Nothing sucks more then watching a tutorial and then getting stuck, i know lol.

anthonyb
Автор

try going into the Sprite class and change the actual poistion the rectangle is being drawn. Remove the variables and add some numbers. My problem was that those variables values were not initialized and 0 was being used, try something like

GL11.glVertex2f(100, 100);
GL11.glVertex2f(100+200, 100);
GL11.glVertex2f(100+200, 100+200);
GL11.glVertex2f(100, 100+200);

anthonyb
Автор

for anyone who is watching this as of feb, 27, 2014 and your box isn't showing up: check to see if you included you glMatrixMode(GL_MODELVIEW); in the initGL method in the Main class. this drove me mad so i hope it helps someone.

xthetempestx
Автор

i had the same problem..the problem isnt the box not rendering, its that its off screen. inside the Game() constructor, where it says Player.SIZE / 2 , remove the /2 in both parameters. At least that was the problem for me. Or try changing the points inside the Sprite class where the staring vertex is drawn at. Hope this helps! Nothing sucks more then watching a tutorial and then getting stuck, i know lol.

anthonyb
Автор

Note: This is before watching the full video. Are these tutorials later on going to add graphics (As in like .pngs)

SergeantBalthazar
Автор

So it's pretty much a trade off between coding and hard-drive space :P But, do you know what other mechanics you'll be adding before we start the graphics?

SergeantBalthazar
Автор

Im having the same problem has Herps, my player isnt showing up

Awtsmoos
Автор

On more question: Are we going to be utilizing sprite sheets, or is everything going to be having to be it's own image? (My vote goes towards sprite sheets)

SergeantBalthazar
Автор

I have fixed the problem with the rendering of the square, but now my problem is that the square will not move when the keys are pressed. Any ideas?

xXBlackHawkXx