Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (732)
Games in Android Showcase (221)
games submitted by our members
Games in WIP (806)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 2 3 [4] 5 6 ... 10
 31 
 on: 2017-07-20 18:30:07 
Started by tariqbroadnax - Last post by SteveSmith
You don't say where "effects" comes from.  However, I would use an interface like ICollideable:-

1  
2  
3  
interface ICollideable {
    void applyAll(Effects[] effects); // Maybe give it a more appropriate name and signature depending on how it's used.
}


then use it such as:-

1  
2  
3  
4  
5  
6  
7  
8  
for(Collision collision : rigidBody.getCollisions())
{
 if(collision.collider instanceof ICollideable)
 {
   ICollideable collideable = (ICollideable) collision.collider;
   collideable.applyAll(effects);
 }
}


The, for every entity that should do something when collided with (i.e Character), implement the interface.

 32 
 on: 2017-07-20 18:14:22 
Started by dime26 - Last post by orangepascal
yeah the robotality guys actually told me how they did it, so I came up with this code which is basically the same Smiley

 33 
 on: 2017-07-20 16:01:33 
Started by tariqbroadnax - Last post by 65K
A modified #2 looks like a viable and - very good - simple solution.
Except using enhanced loops maybe.

2. Keep a list of all characters ---

1  
2  
3  
4  
5  
6  
for (Collision collision : rigidBody.getCollisions()) {
   Character character = scene.getCharacters().get(collision.collider)
   if (character != null) {
      character.getEffects().applyAll(effects);
   }
}


 34 
 on: 2017-07-20 15:19:17 
Started by dime26 - Last post by bullen
It's now released, java gaming FTW! You could buy it only to show support!

 35 
 on: 2017-07-20 12:31:51 
Started by philfrei - Last post by gouessej
Actually, I misread the article I quoted as it states that NXT won't be supported on mobiles and tablets. Anyway, I don't think that it will use Java on mobiles as it will support iOS, not only Android.

 36 
 on: 2017-07-20 07:52:13 
Started by BurntPizza - Last post by dime26
Big refactor job of current code base, creating classes etc and also blogged for first time in a while to capture the posts I have made to this thread recently https://carelesslabs.wordpress.com/2017/07/19/zero-hour-gamedev.

Not quite ready to post my game to the "wip-games-tools-toy-projects" section just yet.


 37 
 on: 2017-07-20 06:41:08 
Started by SteveSmith - Last post by SteveSmith
Thanks.  IMHO JME is great, not just for prototyping.  It's very easy to get an FPS up and running with physics etc...

 38 
 on: 2017-07-20 04:21:59 
Started by BurntPizza - Last post by kingroka123
Here's a quick and dirty look at the game I've been working on for the past month.
<a href="http://www.youtube.com/v/YMPYCGtUCSA?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/YMPYCGtUCSA?version=3&amp;hl=en_US&amp;start=</a>

Deep (working name) is a roguelike dungeon crawler with a robust and creative spell system (which I am still developing, I'll make a post here once the spell system is finalized).

 39 
 on: 2017-07-20 02:56:27 
Started by tariqbroadnax - Last post by tariqbroadnax
@Kevin

I store collisions because I want to handle all logic in my update method. 'Tis also the reason why I don't use observers. Both, observers and polling, work in this scenario. Observers, however, tend to be slightly harder to follow because they have no linear order.

'Tis not much different from my #2 and #3. Similarly, I want to minimize coupling of my character logic and physics logic. TBH, I would rather couple my scene and characters than my physics and characters because neither rigid body nor its fields need to know about characters.

 40 
 on: 2017-07-20 01:51:02 
Started by tariqbroadnax - Last post by KevinWorkman
How exactly is
1  
rigidBody.getCollisions()
calculated? What exactly does it contain?

If you need to know which characters are colliding with
1  
rigidBody
, why don't you have something like this:

1  
2  
3  
4  
for(CharacterCollision collision : rigidBody.getCharacterCollisions())
{
  collision.getCharacter().getEffects().applyAll(effects);
}


I'm also a little suspicious of why you need to keep around a collection of what's colliding instead of doing applying the effects whenever you detect the collision, but in any case I think you should just go with whatever makes the most sense to you.

Pages: 1 2 3 [4] 5 6 ... 10
 
Archive (402 views)
2017-04-27 17:45:51

buddyBro (586 views)
2017-04-05 03:38:00

CopyableCougar4 (1044 views)
2017-03-24 15:39:42

theagentd (1073 views)
2017-03-24 15:32:08

Rule (1049 views)
2017-03-19 12:43:22

Rule (1033 views)
2017-03-19 12:42:17

Rule (1025 views)
2017-03-19 12:36:21

theagentd (1164 views)
2017-03-16 05:07:07

theagentd (1107 views)
2017-03-15 22:37:06

theagentd (833 views)
2017-03-15 22:32:18
List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05

SF/X Libraries
by SkyAphid
2017-03-02 06:38:56

SF/X Libraries
by SkyAphid
2017-03-02 06:38:32

SF/X Libraries
by SkyAphid
2017-03-02 06:38:05

SF/X Libraries
by SkyAphid
2017-03-02 06:37:51
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!