In my game class, I call two objects from another class (objA and objB) like so:
for i=1, countA do
pos.x = pos.x + 15
objA = objClass:new("objClass", group, pos)
wArray[i]=i
end
for j=1, countB do
pos.x = pos.x + xPoint
objB = objClass:new("objCLass", group, pos)
end
I need the for loop because I want to add random number of these objects on my game class. My problem with this is, I want to position a and b simultaneously on my game. For example: objA - objA - objB - objB - objA or objB - objA - objB - objB. However, given my current code, the pattern I end up getting would be all objA first before adding all objB objects.
I know the simple answer would be to just use a single for loop but the problem I see with that is that I need to have at least 1 objA and 1 objB in my game. I can't have all objB or all objA. What would be the best approach to get them to position randomly together? Thanks in advance.