OK, so I do not know if I found a bug or it's just something I cannot figure out. Most likely the latter. However I am posting here in the "How do I?" because I believe that there are some create techniques that can be learned from this particular project such as a good example of how to work with your dynamic objects (ships, bullets, anything that you are going to destroy the first static and create more dynamically throughout the game play. It also uses families, teaches a very good technique on using thrusters and a different take on simulating a 3D starfield where the player is always in the middle of the screen.
The CAPX uses the Spaceship plugin which resides right here -> https://www.scirra.com/forum/behavior-spaceship-movement-behavior_t62411
Theory of operation
The player ship is spawned by and centered on the HUD object (which is a dummy and invisible for this test). The function for crating the players ship takes care of creating all other objects needed as well as setting dynamic properties such as Thruster Level (Rotation Rate), Maximum speed,including acceleration and deceleration as well as adjusting the Exhaust (Particles) to reflect different levels of engines.
Since the player is locked in place the spaceship object is used to move the stars to simulate the player moving. the CreateStars() function creates 60 stars on 3 different layers. You could also just use a family instance variable here but for clarity and teaching sake I just separated them into 3 layers.
When you debug and change the, change the setting for CreatePlayer (line #12), last line, Set PlayerEngineLevel(1-10). This should replace the values (default) in the Stars Spaceship properties and it does not. As a matter of fact, you can tell from the Debug Log that execution stops for some reason in SetPlayerengineLevel() after calling
debug(Function.Param(0)&" is in valid range")[/code:3fbwjhey] and before [code:3fbwjhey]debug("Exhaust speed set to "&Exhaust.InitSpeed)[/code:3fbwjhey].
Th same thing is happening with setting the properties of the Exhaust or Exhaust(s) [Family]. They do not change and maintain the initial properties. So everything works (but different star speeds) from the Editor Default Settings. If you set the Max Speed, Acc and Decc of the stars to 0 and then callthe SetPlayerEngineLevel with a value from 1 to 10 it should set the properties. It does not.
[b]So what does not work?[/b]
[ul]- Changing the values (Initial Speed & other properties) for the particle object (exhaust)[/ul]
[ul]- Changing the spaceship object properties (Max speed, Speed, Acc and Decel) for the stars[/ul]
[b][i]You can download the CAPX here -> [url=https://i2tmlabs.com/IsThisABug.capx]https://i2tmlabs.com/IsThisABug.capx[/url][/i][/b]
I'm asking for help to make this system work flawlessly and with maximum performance. After we reach that point I will wrap it up in a beautiful Tutorial package for the community.
Thanks for the help in advance, Chow!
[i]* UPDATED CAPX - 3 May 2015 *[/i]
[i]* UPDATED CAPX - 4 May 2015 *[/i]
[b]SOLVED (Pretty Much)[/b]
I have some issues with the syncing stars after changing values ... but it is working. Please put some more eyes on this and see if you can tell where it's going wrong?