GPWiki.org
GPWiki.org
It is currently Sun May 19, 2013 4:03 pm

All times are UTC




Post new topic Reply to topic  [ 19 posts ] 
Author Message
PostPosted: Fri Aug 12, 2011 1:38 am 
411 Operator
User avatar

Joined: Sat Dec 09, 2006 4:00 am
Posts: 475
Location: Here At The Moment.
Hi,

How would I implement creating missiles and having them move from left to right starting at my sprite on the left side of the screen.

And also how to detect if one of the missiles will hit a wall on the right hand side of the screen.


Here is a little more detail:

My Sprite moves up and down with the Y axis on the left side of the game screen.

I want the sprite to shoot missiles starting at the sprite and they will shoot to the right.

I want the missiles to implement collision detection too, ex: hitting walls, other sprites etc.

Thank you all!

_________________
"They don't make bugs like Bunny anymore." â€â€


Top
 Profile  
 
PostPosted: Fri Aug 12, 2011 5:51 pm 
Mumbo Jumbo
User avatar

Joined: Fri Aug 20, 2004 1:15 pm
Posts: 804
Location: Michigan, USA
create a missile class with x, y, and other sprite type subs
set its x/y to a location in relation to the ship sprite

each update add to the x, and check for collisions with other sprites and stuff

the System.Drawing.Rectangle class has an intersectwith function that would work good for basic square based collisions

for more missiles at once, try making an array[] of missile classes

_________________
The path to hell is paved with clever code.


Top
 Profile  
 
PostPosted: Sun Aug 14, 2011 5:33 pm 
411 Operator
User avatar

Joined: Sat Dec 09, 2006 4:00 am
Posts: 475
Location: Here At The Moment.
Moglor wrote:
create a missile class with x, y, and other sprite type subs
set its x/y to a location in relation to the ship sprite

each update add to the x, and check for collisions with other sprites and stuff

the System.Drawing.Rectangle class has an intersectwith function that would work good for basic square based collisions

for more missiles at once, try making an array[] of missile classes


I keep messing up, I understand your logic, but I dont know how to apply it.

_________________
"They don't make bugs like Bunny anymore." â€â€


Top
 Profile  
 
PostPosted: Mon Aug 15, 2011 1:14 pm 
King Code Monkey
User avatar

Joined: Wed Sep 01, 2004 3:05 pm
Posts: 11182
Location: Abingdon, MD
code?

_________________
Bored? Head on over to my blog and see what I'm up to.

Microsoft XNA MVP


Top
 Profile  
 
PostPosted: Mon Aug 15, 2011 1:24 pm 
Dexterous Droid
User avatar

Joined: Wed Aug 18, 2004 7:40 pm
Posts: 3735
Location: South Africa
You need a game loop. Do you have one?

_________________
Whatever the mind can conceive and believe, it can achieve


Top
 Profile  
 
PostPosted: Thu Aug 18, 2011 5:19 am 
411 Operator
User avatar

Joined: Sat Dec 09, 2006 4:00 am
Posts: 475
Location: Here At The Moment.
I dont got any code, I dont know where to start.

_________________
"They don't make bugs like Bunny anymore." â€â€


Top
 Profile  
 
PostPosted: Thu Aug 18, 2011 12:18 pm 
King Code Monkey
User avatar

Joined: Wed Sep 01, 2004 3:05 pm
Posts: 11182
Location: Abingdon, MD
I recommend starting here. The content is applicable to any platform.

_________________
Bored? Head on over to my blog and see what I'm up to.

Microsoft XNA MVP


Top
 Profile  
 
PostPosted: Thu Aug 18, 2011 3:06 pm 
411 Operator
User avatar

Joined: Sat Dec 09, 2006 4:00 am
Posts: 475
Location: Here At The Moment.
Machaira wrote:
I recommend starting here. The content is applicable to any platform.


I already downloaded and did much of the tutorials, its just tough implementing the code into a game of my own.

_________________
"They don't make bugs like Bunny anymore." â€â€


Top
 Profile  
 
PostPosted: Thu Aug 18, 2011 3:26 pm 
King Code Monkey
User avatar

Joined: Wed Sep 01, 2004 3:05 pm
Posts: 11182
Location: Abingdon, MD
Don't try to implement the code. Learn from it and write your own.

_________________
Bored? Head on over to my blog and see what I'm up to.

Microsoft XNA MVP


Top
 Profile  
 
PostPosted: Thu Aug 18, 2011 3:32 pm 
411 Operator
User avatar

Joined: Sat Dec 09, 2006 4:00 am
Posts: 475
Location: Here At The Moment.
Machaira wrote:
Don't try to implement the code. Learn from it and write your own.


Yeah, you are kind of right. I would try to implement the code, and it turns out variables, classes, etc get all messed up.

_________________
"They don't make bugs like Bunny anymore." â€â€


Top
 Profile  
 
PostPosted: Fri Aug 19, 2011 3:14 am 
Octogenarian

Joined: Thu Aug 04, 2011 12:00 am
Posts: 87
Location: Arizona
Here is a small C# game that loads several sprites and lets you shoot an arrow at them. You can learn by studying the code in this little example. But, if you're a beginner I recommend a simpler language than C#. It's really by no means "easy" no matter how you look at it. Nothing from Microsoft will be, because these are pro tools. What you might consider is Python. Very simple to install and use.

www.jharbour.com/vcsforteens/VCSTeensShootingGame.zip

_________________
Amazon Author Page
Game Dev Forum
Facebook Page


Top
 Profile  
 
PostPosted: Fri Aug 19, 2011 3:17 am 
411 Operator
User avatar

Joined: Sat Dec 09, 2006 4:00 am
Posts: 475
Location: Here At The Moment.
twobitcoder wrote:
Here is a small C# game that loads several sprites and lets you shoot an arrow at them. You can learn by studying the code in this little example. But, if you're a beginner I recommend a simpler language than C#. It's really by no means "easy" no matter how you look at it. Nothing from Microsoft will be, because these are pro tools. What you might consider is Python. Very simple to install and use.

www.jharbour.com/vcsforteens/VCSTeensShootingGame.zip


I know VB.NET also, so I dont think it will get much 'simpler'.

_________________
"They don't make bugs like Bunny anymore." â€â€


Top
 Profile  
 
PostPosted: Fri Aug 19, 2011 7:22 pm 
Octogenarian

Joined: Thu Aug 04, 2011 12:00 am
Posts: 87
Location: Arizona
What do you mean? Your sentence doesn't make sense.

_________________
Amazon Author Page
Game Dev Forum
Facebook Page


Top
 Profile  
 
PostPosted: Fri Aug 19, 2011 10:21 pm 
twobitcoder wrote:
What do you mean? Your sentence doesn't make sense.


You stated I should learn Phython if I am a beginner at programming. I am not a beginner, I am novice I would say. I know .NET and I think it would be necessary if I moved on to C# and XNA.


Top
  
 
PostPosted: Sat Aug 20, 2011 3:55 pm 
Octogenarian

Joined: Thu Aug 04, 2011 12:00 am
Posts: 87
Location: Arizona
Guest wrote:
twobitcoder wrote:
What do you mean? Your sentence doesn't make sense.


You stated I should learn Phython if I am a beginner at programming. I am not a beginner, I am novice I would say. I know .NET and I think it would be necessary if I moved on to C# and XNA.



No, I did not say that. I said "you might consider Python". I said nothing about your skill level. If you have an ego problem, you'll never learn anything.

_________________
Amazon Author Page
Game Dev Forum
Facebook Page


Top
 Profile  
 
PostPosted: Mon Aug 22, 2011 1:13 am 
411 Operator
User avatar

Joined: Sat Dec 09, 2006 4:00 am
Posts: 475
Location: Here At The Moment.
twobitcoder wrote:
Guest wrote:
twobitcoder wrote:
What do you mean? Your sentence doesn't make sense.


You stated I should learn Phython if I am a beginner at programming. I am not a beginner, I am novice I would say. I know .NET and I think it would be necessary if I moved on to C# and XNA.



No, I did not say that. I said "you might consider Python". I said nothing about your skill level. If you have an ego problem, you'll never learn anything.


I do not have an ego problem. I would tell you if I did. You didn't know anything of my skill level, I was just stating what I believe I am in terms of my skill, so that you know I at least know .NET.

_________________
"They don't make bugs like Bunny anymore." â€â€


Top
 Profile  
 
PostPosted: Mon Aug 22, 2011 7:24 am 
Bibliotherapist
User avatar

Joined: Wed Nov 03, 2004 1:28 pm
Posts: 6704
Location: Lincoln, Englandshire
Gents, we're getting a bit off track here. TwoBitCoder uploaded a simple example to demonstrate missile techniques, was that any help MadGamer? Or do you have more questions?

_________________
10 PRINT "Bad Monkey ";
20 GOTO 10


Top
 Profile  
 
PostPosted: Fri Oct 14, 2011 10:03 pm 
Grand Optimizer
User avatar

Joined: Mon Jan 17, 2005 6:01 pm
Posts: 352
Location: Canada
I would highly reccomend XNA for every aspect of your game, aside from any multiplayer functionality.

Literally - when you start a new XNA project, it pre-writes the basic framework code and if you run it without typing anything, you get a working game window running at 60+ FPS.

What you do inside that gameloop is up to you.

The only thing is, you'l need to buy a book. I have XNA GAME STUDIO Creator's Guide by Stephen Cawood and Pat McGee. The only other alternative(even if your only developing for PC) is signing up for:
a) An XBOX Live GOLD membership
b) An MSDN APP HUB Creator's Club Membership
c) not sure what else

All of which, of course, cost MONEY

Just buy a book. lol

But as for power and ease, XNA is the shiznat. il never look back.

EDIT: DISCLAIMER - youl need to learn C# instead of VB. But again - I did. It wasn't hard. And I'l never look back. VB and me had some good times, but it's over. I'm in a better place now.

_________________
"None are more hopelessly enslaved than those who falsely believe they are free."
"It is no measure of health to be well adjusted to a profoundly sick society."
"Hope is the first step on the road to dissapointment." -Jonah Orion
http://tankzgame.blogspot.com


Top
 Profile  
 
PostPosted: Sat Oct 15, 2011 12:16 am 
King Code Monkey
User avatar

Joined: Wed Sep 01, 2004 3:05 pm
Posts: 11182
Location: Abingdon, MD
Jimbo wrote:
The only thing is, you'l need to buy a book. I have XNA GAME STUDIO Creator's Guide by Stephen Cawood and Pat McGee. The only other alternative(even if your only developing for PC) is signing up for:
a) An XBOX Live GOLD membership
b) An MSDN APP HUB Creator's Club Membership
c) not sure what else

All of which, of course, cost MONEY

Just buy a book. lol

But as for power and ease, XNA is the shiznat. il never look back.

EDIT: DISCLAIMER - youl need to learn C# instead of VB. But again - I did. It wasn't hard. And I'l never look back. VB and me had some good times, but it's over. I'm in a better place now.

To do a PC XNA game you don't have to buy anything. VS Express is free, XNA Game Studio is free. That's all you need. Information is easily found here, GameDev.net, many other places. There's no need to buy a book.

Oh, and you can use VB.NET to do XNA games. :)

_________________
Bored? Head on over to my blog and see what I'm up to.

Microsoft XNA MVP


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group