My group and I are writing a space shooter game. We store the player and hazards in and NSMutableArray called objects. I just finished writing a function to control the players movement using tilt controls, but to test it I need to pass in the player when I call the function and I can't seem to access the player from the objects array. Here's my code:
public var objects: NSMutableArray!
objects.add(Player(pos: GLKVector3(v: (0.0, 0.0, -5.0)), up: GLKVector3(v: (0.0, 1.0, 0.0)), forw: GLKVector3(v: (0.0, 0.0, -1.0)), hp: 5, dmg: 1));
objects.add(Satellite(pos: GLKVector3(v: (2.0, -2.0, -40.0)), up: GLKVector3(v: (0.0, 1.0, 0.0)), forw: GLKVector3(v: (0.0, 0.0, -1.0)), hp: 5, dmg: 1, spd: 2.0));
objects.add(Satellite(pos: GLKVector3(v: (-2.0, 2.0, -50.0)), up: GLKVector3(v: (0.0, 1.0, 0.0)), forw: GLKVector3(v: (0.0, 0.0, 1.0)), hp: 1, dmg: 1, spd: 2.0));
myDeviceMotion(objects.object(at: 0));