• Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Day 26

Sign in to follow this  


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.


[size=2]PS: Sorry for the bad english.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement