How to identify instance of coins etc.

13 views
Skip to first unread message

Martin Anon

unread,
Oct 21, 2015, 6:01:47 PM10/21/15
to ReplicaIsland Coding Community

Hi
Hoping somebody could help me with this problem.

I've added bluetooth for multiplayer, actually just a simple server one client setup.
I now have both players able to move about in a level. I really struggled with that :)
My problem is this: When a player collects a coin, that coin should dissapear on both devices.
When I collect a coin on my device, how do I get that coins identity? I need to send that coins identity to the other device so that it can be removed.
I thought maybe gameObject.hashCode() would work but it seams to be different on both devices.

I'm quite new to java/android and I've learnt a lot from RI, but I'm really stuck on this.
Any help very much appreciated.

Martin.

Chris Pruett

unread,
Oct 21, 2015, 6:24:19 PM10/21/15
to replica-island-...@googlegroups.com
Hi Martin,

I recommend just coming up with an identifier that is the same on both devices (maybe a string or hash based on the starting position?) and using that to synchronize events on both ends.

Chris

--
You received this message because you are subscribed to the Google Groups "ReplicaIsland Coding Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to replica-island-coding...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Martin Anon

unread,
Oct 22, 2015, 3:09:22 PM10/22/15
to ReplicaIsland Coding Community

Hi Chris, thanks for the reply, and THANKS for not abandoning those of us still learning from your work!

An identifier is what I must do, I'd just hoped that something might have already been in place and I was not seeing it.

Martin.
To unsubscribe from this group and stop receiving emails from it, send an email to replica-island-coding-community+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages