Hi,
I’m trying to make a game like this…
https://www.youtube.com/watch?v=xT4ksAgQouc
but i don’t know where to start with…
I made the grid and spawn all the virus ( as display.newRect )
after that i made the control system for the new spawned pill.
Then, I set the a timer to transit down the pill. When the raycast detect the virus, it pause the timer.
and i don’t know how to detect the virus and pill.
I have a virusTable and pillTable for them when it spawns
[lua]newPill = display.newRect ( group, 0, 0, gameSize, gameSize )
newPill:setFillColor( 0.8, 0.1, 0.1 ); newPill.pillType = “red”
pillTable[newPill] = newPill
newVirus = display.newRect ( group, virusX, virusY, gameSize, gameSize )
newVirus:setFillColor( 0.8, 0.1, 0.1 ); newVirus.virusType = “red”
virusTable[newVirus] = newVirus[/lua]
in raycast: should i use something like this??
( i have the new spawned pill in the control group, and when the new pill spawn it will remove it from the group and the new one will replace it)
[lua] down = gameSize + 1
local testForDownHit = physics.rayCast (control_Group[a].x, control_Group[a].y, control_Group[a].x, control_Group[a].y + down, “sorted”) or {}
for p = 1, #testForDownHit do
if ( testForDownHit[p].object.pillType == v.virusType ) then
print (“hit”)
end
end[/lua]
can you give me some advice on
- detecting all those virus and test for match.
- should i use 2 tables for both virus and pill?
- how to separate the pill to half, when the match done
- should i use collision on this game or raycast