« first day (541 days earlier)      last day (4477 days later) » 
00:00 - 03:0003:00 - 00:00

12:50 AM
Does anyone have any links for some tutorials on 2D Game Physics?
 
Just got done making a nice long descriptive answer for this question gamedev.stackexchange.com/questions/23027/… and the author deletes it before I finish :(
 
lol :(
 
32
Q: Resources for 2d game physics

Erik ForbesI'm looking for some good references for learning how to model 2d physics in games. I am not looking for a library to do it for me - I want to think and learn, not blindly use someone else's work. I've done a good bit of Googling, and while I've found a few tutorials on GameDev, etc., I find the...

 
Thanks ClassicThunder! :D
 
12:59 AM
@ClassicThunder bonus round: he reposted it on SO: stackoverflow.com/questions/9042009/…
 
saw that and left a nasty comment
 
hahaha
 
Is anyone here familiar with SDL... I still haven't got this bullet thing to work.. :/
Its really getting under my skin now... I haven't made progress on my space shooter for days
:l Meh
 
1:11 AM
I am
Post code or something
 
:D Oh sweet
Oh alright
Um, just to let you know, My code may seem ridiculously confusing... :(
Im not that good at C++ :L
 
at worst, it's probably as bad as mine
maybe worse.
 
thats what you get for using C++
 
Lol, so C++ is bad?
or hard?
 
1:14 AM
Yes
 
Yeah, it can be a bit challenging at sometimes.... It's my first programming language so, I expect it to be hard :)
if(spacebar)
{

int frame2 = 0;


if(once2 == 0)
{
projectilex2 = x + 19;
projectiley2 = y + -35;
projectilex3 = x + 19;
projectiley3 = y + -35;
}

if(frame2 == 3)
{
frame2 = 0;

}

apply_surface(projectilex2,projectiley2,ShootStuff,screen,&lazers[0]);


frame2 ++;
projectiley2--;


once2++;

apply_surface(projectilex3 - 4,projectiley3,ShootStuff,screen,&lazers[0]);
projectiley3--;


if(once2 == 250)
{
once2 = 0;
spacebar = false;
}

}
O_o
Okay, thats my shoot function... It works as expected except, I cant get it to rapid-fire or anything
For example if I hit the spacebar(and continue holding it) I want the ship to fire bullets until the user releases his hand or something
But... Whenever I hit spacebar, I have to wait until the first bullet clears to draw another one
 
uhh... use pastebin.com or something....
 
Oh sorry :l
Im a noob :P
 
also, first programming language. C++ is bad for that. like, really bad for that :(
 
they should have the same formatting here as for the answers :/
 
1:18 AM
you can do "fixed width" on chat messages, but it isn't obvious, and it still doesn't look as pretty
 
though, @CodeAssasssin, if you're code hasn't changed from when you asked your original question, I can look at that, too....
 
Yeah, you can, I really didn't get the vector thing they suggested to do :l
 
also you accepted an answer on your "multiple bullets on screen" thing...
yeah
 
Yep. I really just gave up
 
1:20 AM
this is why C++ is bad for first language :(
 
:L
Lol
Yeah. But, Im too far in to quit now :D
 
ok.
 
Hmm... I dont think I have any comments in my shoot function, so I'll see If I can explain a few things
 
i think i can figure out the basics
 
1:23 AM
but... might be easier to see all your code. is it in one giant file?
 
Yep. Im too lazy to separate it all in one file
* seperate files
Do you want me to give you my main.cpp?
 
yeah, that'd be easier, i think
 
though based on the small amount of code there, you're going to have to at least use an array to start with
 
1:31 AM
ok, let's start simple. do you know what an array is?
 
Im pretty sure its a way to store elements
or numbers
It's a bit like a vector only C-styled?
 
well. sort of. do you know what a vector is?
 
Same thing as an array?
 
see, now we're just going in circles :P
 
:P
Ah alright
A vector is.... idk
lol
 
1:33 AM
ok, that's fine
so, what is an array?
 
An array is something that can store elements or numbers?
Im not sure
 
or possibly simpilier, do you know what variables are?
 
Of course
 
alright. what are they?
 
Variables are integers,floats, etc
 
1:35 AM
ok, what do they do?
 
:/ They allow the user to assign them specific values for computation etc
 
alright, good an explaination as any
so you can store numbers and stuff in variables
now, an array is a way to keep track of a lot of variables at once
 
Thats more efficient than declaring a bunch of variables :). Thanks for the explanation
 
something like int bullets[10] will let you store a list of 10 integers
 
That allocates space for 10 integers in the array bullets,right?
 
1:38 AM
and you can access invididual values in an array by using bullets[0]; bullets[1] etc.
yep
 
Mhm
got it
 
now. objects. do you know what those are?
 
Yep, they are things that give access to a classes functions
?
 
sure, we'll go with that. now, what are classes, then?
 
Ways to store functions and variables for certain things/entities in your program?
 
1:41 AM
yes.
 
(there's more to all these things, but for the basics, this is good enough)
so, in the answer of the question you asked, the person mentioned creating a class for the bullet
that would let you store stuff like location, and whatever else, in a single spot
 
Yep, I would probably need access to the player class so I'd probably do something like this:
class Bullet: public Player
???
 
nah
 
? Really?
 
1:44 AM
you don't want to have the bullet class inherit from the player class.
that's really bad
 
:L
How so?
 
easiest way would be to have Bullet be in it's own class, and then give the player class an array of, say, 10 bullets
aka: Bullet bullets[10]; in the Player class definition
 
Hmm
Alright
Let me make the class now... brb
Alright I've made the separate bullet class, so now I need the array right?
 
yes
 
should this be under private or public??
I'm guessing private
 
1:48 AM
eh, doesn't matter too much, but private would be a bit better.
 
I agree
Alright, bullet[10] array is done
 
(actually thinking about it even more, i messed up. put the bullet array in your main game loop program part, accessing everything via the Player is going to be a problem)
 
Alright, so I'm going to take the bullet array to the main game loop(the while statement in the main function), and keep the Bullet Class?
Kk, its in my loop
 
keep the Bullet class, put the bullet array declaration after this line: buttonsound = Mix_LoadWAV( "ButtonSound.wav" );
keep it outside of the actual loop
 
sorry about that
Internet these days
 
1:54 AM
not a problem
 
anyway
I put the array below that statement
 
alright. so, now we need to do something with those bullets
 
Position them? Move them? Then show them?
 
yeah
 
Hmm... doesnt that mean I would need access to the ships coordinates? Its coordinates are privates... :(
 
1:57 AM
probably, yes
 
and they aren't global.
 
there's two solutions
make the coordinates public, or make a function that returns the coordinates
the latter is technically better
 
Function?
Hmm maybe I should just make it global, idk
 
don't make it global
it'd be better to make the coordinates public than make them global
 
kk
so its public: int x,y
 
2:00 AM
yep, that'll work
 
then make another pair of variables exactly the same but global?
 
why global?
 
Ah never-mind, kinda lost track for a moment :P
*got off-topic
 
hmmm, alright, another thing, your player should not be where you handle input
move that to your main loop function (where you currently call p.handle_input())
feel free to turn your player velocity stuff public when you do that, because seriously who cares?
 
@thedaian Which piece of coed should I move?
*code
When you say the player should not be
where I handle the input to move?
 
2:07 AM
everything in Player::handle_input() should be in p.handle_input();
 
kk done
 
alright. everything still compiles and works, right?
 
okay it's saying that bullet was not declared in this scope
My array is currently acting up :P
Hold on
bullet[10];
Weird... does that array look strange to you?
 
if that's all you have on that line, then that's not going to work
 
set_clips(); //Make the button
set_clips2();
Button myButton( 190, 230, 254, 58);
ExitButton myExitButton(195,360,241,54);
buttonsound = Mix_LoadWAV( "ButtonSound.wav" );
bullet[10];
 
2:14 AM
yeah
 
This part right here. :l
 
you need a type for that bullet[10];
 
Okay, confused....
 
something like Bullet bullets[10]
 
kk it works
Everything compiles fine.
 
2:16 AM
hooray
 
alright, the next part is getting those 10 bullets to do something
 
Totally stuck and confused on that part :( Haven't dealt with arrays like this before
 
assuming you have a function like Bullet::show() to display them, you need to now loop through the array to call that function
 
hmm, so something like in the Bullet::show function
Do this:
for (int i; i < bulletsize; i++)
{ bullet[i] }
?
 
2:22 AM
kind of sort of not really at all
 
Hello ppl
Hey code assassin, got you shooting game to work?
 
No :L
Lol
 
right now, that bullet[10] is 10 Bullet objects
 
seems that thedaian is helping you, that's nice.
 
kk
so the array bullet has 10 object that store the bullets
 
2:23 AM
Hey @thedaian, won't be better to use a array of pointers, or a list of pointers?
 
@Gtoknu yes, but also harder
 
hm, maybe
 
@CodeAssasssin is learning C++ as his first language (bad idea), so pointers... let's not even go there
 
Lol true
 
we're doing this as "babbies first code" example
 
2:24 AM
Lol, I can do pointers :)
Im not that bad
 
@CodeAssassin What are pointers, how can you allocate those and how can you delete those?
 
from what i've seen, you are :P
 
:P Give me a break, Im taking this on at 12 years old
Most of this stuff is "magic"
 
Nah, a good age. I Learnt C++ with 11 also.
 
let's ignore pointers. it's not worth it
 
2:26 AM
Ah fine
 
yup
 
Alright, so looping through the array, how's that going to be done?
 
(seriously after you get this done, learn basic programming wit python or javascript or something, because you really need to learn the basics before jumping into copy/pasting from lazyfoo.com's tutorials)
 
Lol
Yep
That was meant as something to start em off
*me
 
you got the basic loop code when you mentioned it.
for (int i=0; i < 10; i++)
{ bullet[i].show(); }
stick that after p.show();
 
2:28 AM
Hey, I'm a little out of time now, but, daian, try to explain my answer to him: gamedev.stackexchange.com/questions/22616/sdl-bullet-movement/…
would save you some time, maybe.
 
@Gtoknu that answer would work.... but it's also pretty advanced stuff
 
Just change the list to an array
 
even then
 
omg haha
 
2:31 AM
@theda
??
Wtheheck
O_o
srry
 
@Gtoknu seriously, @CodeAssasssin is at programming 101 here, your code and answer is good, but it's going to be hard to understand
 
@CodeAssassin, Where are you from, btw? those "kk" laughs are pretty common here in brazil, and pretty uncommon outside here.
 
California :D
 
@thedaian No prob, we can try to teach something more easy to understand to him :)
 
2:32 AM
i believe 'kk' is "ok, ok"
 
Hmm, isnt it okay
not okay,okay
 
almos EVERY people that live in here and use internet laugh as "kkkkkkk"
 
I don't understand why, but they do.
 
I thought that was lol, and rofl
:)
 
2:33 AM
yep, it is.
But I didnt know that it meant that outside here too.
Anyway, what you got so far, @CodeAssassin?
 
Nothing much yet(we have a separate bullet class, and an array that holds 10 bullets), thedaian is just walking me through this
 
Nice
That's pretty much, considering you just need now to add a bullet to the array when you press space, and remove one when it collide with something
 
Yeah, I cant do removing now... I don't have collision yet.
 
Well, you can at least remove when it reaches out of screen
that's easy
 
Yeah
@thedaian I'm honestly not that bad at C++ :P. I've been using SFML for 3 months and I had no problems with that. A friend just told me to use SDL instead of SFML.
 
2:40 AM
SDL is more "low level"
but it is pretty nice also, but to that, you should know very well what you're doing
 
Yeah, I think Physics and math is my problem :l
 
You'll see that this is not the biggest problem with game dev.
 
Hmm, In you opinion what is?
*your
 
There's no "hardest part"
but there's the "boring" parts
 
2:43 AM
I mean, everything if you think a little, you could get an answer very fast.
And there are A LOT, of resources in the internet.
For example. "Oh, I want to add gravity to my game." You can see with a little googling that gravity is just something that accelerate you downward at 10m/s^2
 
I dont even understand that
10*m
/s(squared)?
 
Ah
 
whats the m and s stand for o.o
 
meters
10 meters per second per second
There's no big problem here. When I was younger, I was used to do a lot of math that i didn even understand. When I get in the Highschool, I got to understand the most part of the physics of a game.
 
Too bad, Im in 7th
:L
 
2:47 AM
A lot of your friends will say on the class "I wont ever use that on my whole life!" You'll see that a lot of your teachers are teaching, you already done it before in a game.
 
That is what I realized when i "learnt" in the school functions, matrix, vectors, gravity, etc etc.
 
Meh, I have a lot of work to do :-)
 
Yep (:
It's nice to see someone starting in the game dev early in life
 
Lol, you too. Your 15, I'm surprised :D
 
2:50 AM
Hey, want a advice?
 
If you think you're Ok with C++
Try to use C# and XNA
the syntax is pretty the same, not much hard
 
Hmm... Alright
 
And my first (not the first, but the first complete) game was a Chess Game that I've done with XNA
But before, end this one that you're doing with C++, will be a good exercise :D
 
Yeah, I need to complete this... but thedaian has fell silent :(
 
2:52 AM
yeah..
 
Ah well. I guess I can do this :-)
 
Try to think as you do in the real world
Bullets are objects
When you shoot a gun
a new Bullet is created
And everyframe all your bullets go towards
That should do :D
 
Hmm ._O
Lol, we'll see
Meh, too lazy, I guess I'll just keep it with one bullet :l
 
C'mon guy,
 
> . >
Meh
:L
 
2:56 AM
You'll never learn if you keep lazy
 
Trying again
 
yay
 
00:00 - 03:0003:00 - 00:00

« first day (541 days earlier)      last day (4477 days later) »