I have been playing around with the photo_corona_plugin_sample trying to learn how things work.
In the sample I added some simple code to view the current actors in a room.
local textObject
-------- Added
function getActors()
local me= client:myActor()
print ("ME I’m Player # "…me.actorNr)
local actors=client:myRoomActors()
print ("Players Count "…#actors)
for i = 1 , #actors do
print ("My Actors count = "…actors[i].actorNr)
end
end
local actorsBut= display.newText(“Actors”, 10, 200, native.systemFont, 18)
actorsBut:addEventListener(“tap”,getActors)
if display then
I also added a this :
function client:onActorJoin(actor)
print (“Actor Joined”…actor.actorNr)
end
Sometime everything works fine , other times I get a new actor joined message but when I go to display how many actors are in the room I get 0. Here’s my last run:
Actor Joined6 —client:onActorJoin()
ME I’m Player # 4 --client:myActor().actorNr
Players Count 0 — #client:myRoomActors()
I don’t understand why myRoomActors does not return at least 1 actor when an actor just joined.
i have been using the simulator and a device to test this sample. I removed the max send and receive so the program just keeps running. I would connect with both and then close one down. Start it up again and reconnect. Do this a couple of times and that’s where I got myActor.actorNr= 4 . How does one remove an actor from the room so that the player count remains accurate?
If I join first I should be actor #1 .
Someone else joins they are actor #2.
Actor #2 leaves .
Someone else joins. They should be assigned actor#2 , not actor#3,
Any help would be great.
Thanks
Chris