Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / starting a 2d breakout game

Author
Message
kuljot
15
Years of Service
User Offline
Joined: 2nd Jan 2009
Location: sacramneto, ca united states
Posted: 29th Oct 2009 03:11 Edited at: 29th Oct 2009 06:19
Hey guys once again i'm back. I want to make a 2d breakout style game. I know there is a tutorial for 3d breakotu but i want to make 2d breakout. This is what i have so far.


The first thign i need help with is moving a paddle with mouse left and right. I tryed this many different ways but it never worked. It would only move a tiny bit. So if you can help me with that for starters that would be great. Also Give me some pointers and a foundation to start off of. Screen shot attatched of what i have. Also i did not copy paste code from any where I got it from hands on dark basic pro and chnaged it up. Thanks

Gateway GT5628 Quad Core Desktop Intel Core 2 Q6600 2.4GHz Quad Core 3072MB RAM / 500GB 7200 SATA II Hard drive DVD RW 18X multi dual NVIDIA GeForce 8500GT ....

Attachments

Login to view attachments
Xyus
15
Years of Service
User Offline
Joined: 5th Sep 2009
Location:
Posted: 29th Oct 2009 04:51
I fixed this by storing the position of the paddles x position in the variable xpos# and copied a second "sprite 2,xpos#,870,2" into the do-loop. I also hid the mouse cursor, because it got annoying.

Here is the full edited code:


There are better ways to do this, but thats pretty much the easiest way. That I thought of, anyway.
kuljot
15
Years of Service
User Offline
Joined: 2nd Jan 2009
Location: sacramneto, ca united states
Posted: 30th Oct 2009 00:42
Thanks, now i just need to know how to keep the abll ocked on the paddle sprite until it launches. If soemoen could help with that that would be great. I think i should have posted this is 2d section maybe mod can move it there.

Gateway GT5628 Quad Core Desktop Intel Core 2 Q6600 2.4GHz Quad Core 3072MB RAM / 500GB 7200 SATA II Hard drive DVD RW 18X multi dual NVIDIA GeForce 8500GT ....
Xyus
15
Years of Service
User Offline
Joined: 5th Sep 2009
Location:
Posted: 30th Oct 2009 02:31
I believe removing the ball's positioning from the if h=1 and placing it into the main loop, and adding a condition where if h=0(Thus before the click), the ball's x position will equal the paddle's x position. It should also launch from the paddle's position.

Here is the changed main loop:



Does that help?
kuljot
15
Years of Service
User Offline
Joined: 2nd Jan 2009
Location: sacramneto, ca united states
Posted: 30th Oct 2009 03:44
@Xyus Thanks man you have helped me so much. That moves te ball, but the ball is still a ittle but higher than the paddle, but i will fix that. Thanks oncec again and if you have any more suggestions please post.

Gateway GT5628 Quad Core Desktop Intel Core 2 Q6600 2.4GHz Quad Core 3072MB RAM / 500GB 7200 SATA II Hard drive DVD RW 18X multi dual NVIDIA GeForce 8500GT ....
Xyus
15
Years of Service
User Offline
Joined: 5th Sep 2009
Location:
Posted: 30th Oct 2009 05:39
You're welcome, I'm happy to help.

Quote: " if you have any more suggestions please post. "


Not at the moment (Although, I admit, I haven't actually looked for any problems or inefficiencies, so there could be something totally obvious, of the "Enormous Meteor Landing on my House" magnitude, that my internal Radar didn't pick up on)

If you run into any more problems, though, I'll see what I can do to help.
kuljot
15
Years of Service
User Offline
Joined: 2nd Jan 2009
Location: sacramneto, ca united states
Posted: 30th Oct 2009 07:03
I wish someone else would help too. Now my question is like i am goign to use 2d bricks. So do i just check if sprite 1 is hitting the bricks and then reset velocity and delte the brick. Would i use the sprite hit command. Thanks. If someone has links to tutorials that will tell me how i can make a little level editor to make 2d levels fater that would also help. Thanks in advance.

Gateway GT5628 Quad Core Desktop Intel Core 2 Q6600 2.4GHz Quad Core 3072MB RAM / 500GB 7200 SATA II Hard drive DVD RW 18X multi dual NVIDIA GeForce 8500GT ....
Xyus
15
Years of Service
User Offline
Joined: 5th Sep 2009
Location:
Posted: 30th Oct 2009 08:36
Quote: " I wish someone else would help too "


Am I not good enough? (Kidding, I know you you mean. More people = more efficient, and multiple viewpoints)

Well, I haven't read them, but after a quick search, here are a few tutorials that have to do with making a 2d Editor. Even if they aren't for this particular type of game, I trust you can edit them into usefulness.

Note: A few may be a bit old and outdated.

http://forum.thegamecreators.com/?m=forum_view&t=34076&b=4


http://forum.thegamecreators.com/?m=forum_view&t=158455&b=1- On this page Mobiius wrote a simple editor, 4th post. It's 3D though, so you'll have to rewrite it in 2D, and for breakout in mind (But the principal of map editing is there)

Hmm, that's all I found. While this forum is loaded with information on how to make a particular part of an editor, it is a bit lacking on full-blown tutorials. I guess you could scrounge all the bits of information up into a working database of knowledge though.

By the way, directly related to the Breakout project, I found this tutorial for a 2D breakout game in the Game Creators Newsletter:

http://www.thegamecreators.com/data/newsletter/newsletter_issue_32.html#15

I hope that something in that short list I posted helps.
Xyus
15
Years of Service
User Offline
Joined: 5th Sep 2009
Location:
Posted: 30th Oct 2009 09:16 Edited at: 31st Oct 2009 00:33
Sorry, I just realized that the breakout tutorial I gave you was a 3D breakout tutorial, most likely the one you mentioned reading at the top of the page (The universe usually works like that)

As to your actual question, When it hits the blocks, You will want to have it reverse on the y-axis. If I have the right idea about how sprite offset works(I'm more at home working with 3D than 2D), you would reset the Y Velocity, so it goes slower, then multiply it by -1, so it goes down, then delete the brick.

I believe you would use the sprite hit command to detect whether the ball and blocks/paddle collide.

So you were pretty much right in all respects. Again, this is true only if how I think it works is how it works.

(Edit) By the way, Mobiius' editor isn't a tutorial, but a block of code. Thought that should be noted. I found it easy to read, though, so thought I should add it anyway
kuljot
15
Years of Service
User Offline
Joined: 2nd Jan 2009
Location: sacramneto, ca united states
Posted: 30th Oct 2009 15:05
Thanks so much man. Actually just to give yu an intro i know 3d programming and made a few moni games. Now i felt i should go back and learn 2d programming. So ill look into the tutorials after i come back from school. Once again thanks.

Gateway GT5628 Quad Core Desktop Intel Core 2 Q6600 2.4GHz Quad Core 3072MB RAM / 500GB 7200 SATA II Hard drive DVD RW 18X multi dual NVIDIA GeForce 8500GT ....
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 30th Oct 2009 20:22 Edited at: 30th Oct 2009 20:24
Oh my. When this thread bumped back to the top, I glanced at it and thought it said "starting a 2d breakfast game", and I thought, "how cool!" Maybe some bacon, or pancakes and sausage.

I really need to get my eyes checked.

Xyus
15
Years of Service
User Offline
Joined: 5th Sep 2009
Location:
Posted: 31st Oct 2009 00:24
Quote: " Actually just to give you an intro i know 3d programming and made a few mini games. Now i felt i should go back and learn 2d programming."


Yeah, I hear that. Like I said, I'm far more proficient in 3D, but I know enough of the theory and application of 2D that, hopefully, I can be of some limited use.

By the way, in case you haven't checked it (You probably have, but it never hurts to ask), here is a sprite plugin for DBP

http://forum.thegamecreators.com/?m=forum_view&t=113378&b=5



Quote: "Oh my. When this thread bumped back to the top, I glanced at it and thought it said "starting a 2d breakfast game", and I thought, "how cool!" Maybe some bacon, or pancakes and sausage.
"


When I read what you said, for whatever reason, My first thought was "I'd buy that game"
kuljot
15
Years of Service
User Offline
Joined: 2nd Jan 2009
Location: sacramneto, ca united states
Posted: 31st Oct 2009 17:19
Hey xyus Thanks,
I was just about to ask for sprite plugins, because the dark basic pro commands are very limited. You read my mind.
Hey do you live in the US. Because i'm thinking we got seperated from the rest of the world. Maybe people in UK can not replky to my post any more.

Gateway GT5628 Quad Core Desktop Intel Core 2 Q6600 2.4GHz Quad Core 3072MB RAM / 500GB 7200 SATA II Hard drive DVD RW 18X multi dual NVIDIA GeForce 8500GT ....
Xyus
15
Years of Service
User Offline
Joined: 5th Sep 2009
Location:
Posted: 31st Oct 2009 23:38
Quote: " Hey do you live in the US. "


Yes, I do.

Login to post a reply

Server time is: 2024-09-28 12:23:44
Your offset time is: 2024-09-28 12:23:44