Jump to content

  • Log In with Google      Sign In   
  • Create Account





Day 26 – [SinC] – Internal improvements, Inverter/Remove gravity and remove forces

Posted by Alex.SilR, in General, SinC 07 November 2012 · 250 views

Mirrored from my blog (en, pt-br).

Today I started refactoring the internal mechanics of winning leaving it much more flexible than it was before. Now when I do the level design will be much easier.

In the winning script I ended up using the singleton (design pattern [or !design pattern]). The singleton is basically a class that is structured in a way that can only be instantiated once. The class has a private constructor and a public get that returns a reference to the object (if not created yet it creates and then returns).

In winning script itself I added the maximum time to complete a level. If the player reaches that time he loses.

After this refactoring I created a script to remove the forces of the cubes (velocity and angular velocity) when pressed Ctrl. All cubes are affected simultaneously. This provides another strategic point, but the player has to know when to use, if he use to save a cube that will leave the level can end up affecting others who are in good trajectories.

Finally I created the script to remove and invert the gravity of the cubes. To remove the gravity the player selects the projectile corresponding and hits the cube with it, if hit again the gravity returns. To invert the gravity the process is the same. The two are independent, that is, if the player invert the gravity and then removing the gravity, and after that return to gravity it will be inverted.

http://www.youtube.com/watch?v=LKDegkjv-Xs&feature=player_embedded

PS: Sorry for the bad english.




December 2014 »

S M T W T F S
 123456
78910111213
141516171819 20
21222324252627
28293031   

Recent Entries

PARTNERS