Ah, Ive been trying this for a while now; I am trying to create an attraction field that follows my main ship. Setting the Fxfield is going all fine and dandy but getting it to the follow the ship is becoming a nightmare.
This is the first method that Im using but does not work,
1 2 3 4 5 6 7 | local function attractToShip(event) Particles.CreateFXField("F1", 0, ship.x, ship.y, 1.5, 50, false) GetFXField("F1").x = ship.x GetFXField("F1").y = ship.y end Runtime:addEventListener("enterFrame", attractToShip) |
This is what I'm doing in a project I'm developing. I moved the ship, then called a function to move the field to the ship's position:
1 2 3 4 5 6 | function moveField (ship) Particles.GetFXField("Field" .. ship.fieldIndex).x = ship.image.x Particles.GetFXField("Field" .. ship.fieldIndex).y = ship.image.y end |
By god it worked! Thank you!
views:1373 update:2011/10/13 16:39:51