Game Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
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:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #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: 101 william_nagels User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 27 m 7 sec
Reputation Power: 2
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's Avatar
crownjewel82 crownjewel82 is offline
rebel with a cause
Dev Shed God (5000 - 5499 posts)
 
Join Date: May 2004
Location: The Batsh!t Crazy State.
Posts: 5,346 crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)  Folding Points: 31453 Folding Title: Starter FolderFolding Points: 31453 Folding Title: Starter Folder
Time spent in forums: 2 Months 3 Weeks 4 Days 10 h 55 m 42 sec
Reputation Power: 1924
This is why we use lists of all objects in games.
__________________
The day I get my hands on the cookbook it's all over. -nicky

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: 101 william_nagels User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 27 m 7 sec
Reputation Power: 2
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,784 Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 4 Weeks 18 h 2 m 3 sec
Reputation Power: 437
should I move this to Java forum?
__________________
Miscellaneous Software
Viper_SB
Developershed E-Support


Anyone else play chess?
Challenge me

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: 101 william_nagels User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 27 m 7 sec
Reputation Power: 2
Send a message via MSN to william_nagels
sure no problem

Reply With Quote
  #6  
Old April 19th, 2007, 10:13 AM
crownjewel82's Avatar
crownjewel82 crownjewel82 is offline
rebel with a cause
Dev Shed God (5000 - 5499 posts)
 
Join Date: May 2004
Location: The Batsh!t Crazy State.
Posts: 5,346 crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)  Folding Points: 31453 Folding Title: Starter FolderFolding Points: 31453 Folding Title: Starter Folder
Time spent in forums: 2 Months 3 Weeks 4 Days 10 h 55 m 42 sec
Reputation Power: 1924
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: 101 william_nagels User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 27 m 7 sec
Reputation Power: 2
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 online now
Kage Bunshin
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2005
Location: The Seven Seas Of Rhye
Posts: 766 tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 5 Days 3 h 35 m 46 sec
Reputation Power: 184
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: 101 william_nagels User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 27 m 7 sec
Reputation Power: 2
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)


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 | 
  
 

IBM developerWorks




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway