Game Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesGame Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 18th, 2007, 08:56 AM
william_nagels william_nagels is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2006
Location: belgium
Posts: 116 william_nagels User rank is Private First Class (20 - 50 Reputation Level)william_nagels User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 7 h 2 m 45 sec
Reputation Power: 7
Send a message via MSN to william_nagels
My problem with multiple collision detection (Java)

Hello,

i don't know how to explain my problem so i've called it:
"my problem with multiple collision detection".

The idea:
you are a guy/girl and need kill all evil aliens.

But the problem is how i know when that guy / girl shoots an alien.
so with other words how do i know when there is a collision between a bullet and an alien.Let's say that there are 50 aliens
and you have unlimited bullets.
When you make a game like pong it's easy because you only have 3 objects.
Do i need to write this like 70000000000 times?
Code:
bullet[0].intersects(evilAlienNR1);

I hope not

Help me java-game-programmers you guys are my only hope

William

Reply With Quote
  #2  
Old April 18th, 2007, 12:52 PM
crownjewel82 crownjewel82 is offline
rebel with a cause
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: May 2004
Location: The Batsh!t Crazy State.
Posts: 5,817 crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)  Folding Points: 53188 Folding Title: Beginner FolderFolding Points: 53188 Folding Title: Beginner FolderFolding Points: 53188 Folding Title: Beginner Folder
Time spent in forums: 3 Months 4 Days 12 h 16 m 39 sec
Reputation Power: 3461
This is why we use lists of all objects in games.
__________________
Dear God. What is it like in your funny little brains? It must be so boring.

Reply With Quote
  #3  
Old April 18th, 2007, 01:14 PM
william_nagels william_nagels is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2006
Location: belgium
Posts: 116 william_nagels User rank is Private First Class (20 - 50 Reputation Level)william_nagels User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 7 h 2 m 45 sec
Reputation Power: 7
Send a message via MSN to william_nagels
Can I ask you how i'm supposed to do that
ArrayList?
Code:
ArrayList alList1 = new ArrayList();

or some kind of ingenious class.
Code:
class bullet{}

Code:
class alien{}

someone help me *puppy face*

William

Reply With Quote
  #4  
Old April 18th, 2007, 03:34 PM
Viper_SB's Avatar
Viper_SB Viper_SB is offline
Psycho Canadian
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Jan 2001
Location: Canada
Posts: 4,845 Viper_SB User rank is Brigadier General (60000 - 70000 Reputation Level)Viper_SB User rank is Brigadier General (60000 - 70000 Reputation Level)Viper_SB User rank is Brigadier General (60000 - 70000 Reputation Level)Viper_SB User rank is Brigadier General (60000 - 70000 Reputation Level)Viper_SB User rank is Brigadier General (60000 - 70000 Reputation Level)Viper_SB User rank is Brigadier General (60000 - 70000 Reputation Level)Viper_SB User rank is Brigadier General (60000 - 70000 Reputation Level)Viper_SB User rank is Brigadier General (60000 - 70000 Reputation Level)Viper_SB User rank is Brigadier General (60000 - 70000 Reputation Level)Viper_SB User rank is Brigadier General (60000 - 70000 Reputation Level)Viper_SB User rank is Brigadier General (60000 - 70000 Reputation Level)Viper_SB User rank is Brigadier General (60000 - 70000 Reputation Level)Viper_SB User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 20 h 16 m 56 sec
Reputation Power: 634
should I move this to Java forum?

Reply With Quote
  #5  
Old April 19th, 2007, 10:09 AM
william_nagels william_nagels is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2006
Location: belgium
Posts: 116 william_nagels User rank is Private First Class (20 - 50 Reputation Level)william_nagels User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 7 h 2 m 45 sec
Reputation Power: 7
Send a message via MSN to william_nagels
sure no problem

Reply With Quote
  #6  
Old April 19th, 2007, 10:13 AM
crownjewel82 crownjewel82 is offline
rebel with a cause
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: May 2004
Location: The Batsh!t Crazy State.
Posts: 5,817 crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 37th Grade (Above 100000 Reputation Level)  Folding Points: 53188 Folding Title: Beginner FolderFolding Points: 53188 Folding Title: Beginner FolderFolding Points: 53188 Folding Title: Beginner Folder
Time spent in forums: 3 Months 4 Days 12 h 16 m 39 sec
Reputation Power: 3461
Ok. Your aliens. Do you have 50 different instances of alien or do you have them in an array or a list? If they're in a list (or array) then you can loop through them for each bullet using a nested loop.

Collections

Reply With Quote
  #7  
Old April 19th, 2007, 10:28 AM
william_nagels william_nagels is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2006
Location: belgium
Posts: 116 william_nagels User rank is Private First Class (20 - 50 Reputation Level)william_nagels User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 7 h 2 m 45 sec
Reputation Power: 7
Send a message via MSN to william_nagels
k thanks going to tryout the collections idea

William

Reply With Quote
  #8  
Old April 19th, 2007, 12:46 PM
tagmanadvance's Avatar
tagmanadvance tagmanadvance is offline
Kage Bunshin
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2005
Location: The Seven Seas Of Rhye
Posts: 930 tagmanadvance User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)tagmanadvance User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)tagmanadvance User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)tagmanadvance User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)tagmanadvance User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)tagmanadvance User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)tagmanadvance User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)tagmanadvance User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)tagmanadvance User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)tagmanadvance User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)tagmanadvance User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 2 Weeks 2 Days 7 h 56 m 24 sec
Reputation Power: 421
Send a message via AIM to tagmanadvance Send a message via Yahoo to tagmanadvance Send a message via XFire to tagmanadvance
Is this for a project? If not, I would try something like GTGE.
It has built in collision detection =D

EDIT: w00t, 300th post =D
Comments on this post
william_nagels agrees: thanks man
__________________
"Java makes impossible things possible, but makes easy things difficult." - Somebody

Reply With Quote
  #9  
Old April 19th, 2007, 01:05 PM
william_nagels william_nagels is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2006
Location: belgium
Posts: 116 william_nagels User rank is Private First Class (20 - 50 Reputation Level)william_nagels User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 7 h 2 m 45 sec
Reputation Power: 7
Send a message via MSN to william_nagels
thanks man

William

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesGame Development > My problem with multiple collision detection (Java)

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap