Welcome to Dream.In.Code
Become an Expert!

Join 149,507 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,341 people online right now. Registration is fast and FREE... Join Now!




startting a 2D game

 
Reply to this topicStart new topic

startting a 2D game, advice please

space invader
23 Jul, 2007 - 01:55 PM
Post #1

New D.I.C Head
*

Joined: 23 Jul, 2007
Posts: 5


My Contributions
I'm just starting to make my first game i have been reading books and looking on the internet for tutorials on games programming. I will be starting it pretty soon but there are a things i cant work out. i was hoping people could give me a few sites for tutorials and advice on what would be the easiest type of 2d game to do. i am using visual c++ with a dirtectx sdk pack installed. the first thing that i need to now is i have planned to set the background as a bmp. but i can't find code that will set the screen boundaries so that my player wont go of the screen. and the second is getting non-player characters to move. i have seen many diffrent techniques for it but it has confussed me about how i should go about.

thanx cool.gif
User is offlineProfile CardPM
+Quote Post

muso
RE: Startting A 2D Game
25 Jul, 2007 - 05:36 AM
Post #2

D.I.C Head
**

Joined: 6 Jul, 2007
Posts: 51



Thanked: 2 times
My Contributions
QUOTE(space invader @ 23 Jul, 2007 - 02:55 PM) *
but i can't find code that will set the screen boundaries so that my player wont go of the screen. and the second is getting non-player characters to move. i have seen many diffrent techniques for it but it has confussed me about how i should go about.


The method you use depends on the type of game your wanting to work on. Do you want the player to bounce off the edge of the screen, or just stop, or even continue on the opposite side of the screen (as in asteroids, for example)?

As for NPCs you could either have them march along a predetermined path (A to B, back to A), and there are various algorithms for determining how they go around obstacles, or you could make them follow simple instructions (like following the left-hand wall, as in some basic puzzle games)...

What I'd suggest is that you try a couple of ideas out in separate projects, and see which you think works best for you.
User is offlineProfile CardPM
+Quote Post

Topher84
RE: Startting A 2D Game
25 Jul, 2007 - 09:39 AM
Post #3

D.I.C Head
Group Icon

Joined: 4 Jun, 2007
Posts: 232



Thanked: 1 times
Dream Kudos: 25
My Contributions
Check out: http://www.planet-source-code.com/

they have several 2D games in different languages which im positive will have the code you are looking for.
User is offlineProfile CardPM
+Quote Post

space invader
RE: Startting A 2D Game
25 Jul, 2007 - 09:42 AM
Post #4

New D.I.C Head
*

Joined: 23 Jul, 2007
Posts: 5


My Contributions
Thanks i have decided on a space invader game i will create 3 diffrent types of enemy and an end level boss. i have also decided on giving the player turbos so my player will look different at the end of the game. i have been looking for some more code on npc's movement and think the best way to do it is by setting them as sprites and having them move along a pre determined path, stop at the edge of the screen and thenmove down and start moving again. any advice for the best coding technique to do this. also i just want it so when my player gets to the edge of this screen he stops even if the keyboard is pressed down any thing i have looked at is wrong any ideas. i am using visual C++ with directx sdk 2006. icon_up.gif
User is offlineProfile CardPM
+Quote Post

Topher84
RE: Startting A 2D Game
25 Jul, 2007 - 12:01 PM
Post #5

D.I.C Head
Group Icon

Joined: 4 Jun, 2007
Posts: 232



Thanked: 1 times
Dream Kudos: 25
My Contributions
QUOTE(space invader @ 25 Jul, 2007 - 10:42 AM) *

Thanks i have decided on a space invader game i will create 3 diffrent types of enemy and an end level boss. i have also decided on giving the player turbos so my player will look different at the end of the game. i have been looking for some more code on npc's movement and think the best way to do it is by setting them as sprites and having them move along a pre determined path, stop at the edge of the screen and thenmove down and start moving again. any advice for the best coding technique to do this. also i just want it so when my player gets to the edge of this screen he stops even if the keyboard is pressed down any thing i have looked at is wrong any ideas. i am using visual C++ with directx sdk 2006. icon_up.gif



im telling you... that site has EXACTLY what you are looking for
User is offlineProfile CardPM
+Quote Post

space invader
RE: Startting A 2D Game
26 Jul, 2007 - 01:32 AM
Post #6

New D.I.C Head
*

Joined: 23 Jul, 2007
Posts: 5


My Contributions
cheers been on that site its really helpful
User is offlineProfile CardPM
+Quote Post

gogole
RE: Startting A 2D Game
26 Jul, 2007 - 02:41 PM
Post #7

D.I.C Head
Group Icon

Joined: 17 Jul, 2007
Posts: 131


Dream Kudos: 25
My Contributions
lets see your game when you are finished.
User is offlineProfile CardPM
+Quote Post

space invader
RE: Startting A 2D Game
27 Jul, 2007 - 09:43 AM
Post #8

New D.I.C Head
*

Joined: 23 Jul, 2007
Posts: 5


My Contributions
i have been given my friends old assignment to use as a game engine from uni last year.it uses directx as its game engine or at least that is what i can make out. i have attached the three big files as word documents because it wont let me send them as cpp. these are the three files as far as i can tell that contol the game. there are another 2 files which are the main game header and cpp file. the cpp file has stuff to load game graphics and sound and loads the game framework. i think i have to code in most of my parameters e.g.screen boundaries and npc's movement and collision detection in the dx header file. is this correct. also is there any good dx tutorial sites you now of. he has said he did it in three months and his is all 2d. i am looking to make the game 2d but the splash screen, option scren etc in 3d. i think that this will be easier but make my game look better than his. is there any bits of code that anybody could give that would make the effects look good. i have some code for an exploding sprite that is really good but i dont know where to put the code in mine? any help much appreciated and i will post it when im done. cheers


Attached File(s)
Attached File  dxhelper.doc ( 57k ) Number of downloads: 96
Attached File  user_game_help.doc ( 126.5k ) Number of downloads: 78
Attached File  This_is_the_dxhelper_header.doc ( 48k ) Number of downloads: 68
User is offlineProfile CardPM
+Quote Post

gogole
RE: Startting A 2D Game
27 Jul, 2007 - 02:18 PM
Post #9

D.I.C Head
Group Icon

Joined: 17 Jul, 2007
Posts: 131


Dream Kudos: 25
My Contributions
i also came up with this idea o making a 2d shooter game . will checkout your docs.all i know is that i will be using directx and nothing else.help needed,are there other alternatives?
User is offlineProfile CardPM
+Quote Post

arfton
RE: Startting A 2D Game
1 Aug, 2007 - 11:38 AM
Post #10

New D.I.C Head
*

Joined: 19 Jul, 2007
Posts: 6


My Contributions
i have been on planet source code but intergrating there code into mine is not what i want to do i want to actually understand what im doing. i have read load of tutorials and none of them have been able to set the screen so my player doesn't walk of it HELP PLEASE ph34r.gif
User is offlineProfile CardPM
+Quote Post

space invader
RE: Startting A 2D Game
1 Aug, 2007 - 11:43 AM
Post #11

New D.I.C Head
*

Joined: 23 Jul, 2007
Posts: 5


My Contributions
i have the same problem any tutorials i have read are useless because the game framework keeps rejecting the code i put in getting some really stupid errors. at least im not the only one searching post back if you find anything. if there is any help you can give please help
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 07:05PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month