Page 1 of 1

create a game with different levels?

PostPosted: Tue Sep 15, 2009 7:17 am
by spook1
Is it possible in Algodoo to crerate a scene with a "goal", e.g. destroy the red start.
Once the goal is reached, a new scene should be started.
This way a game can be vreated consisting of different levels (a serious game consisting of different lessons...)

Martijn

Re: create a game with different levels?

PostPosted: Tue Sep 15, 2009 7:26 am
by standardtoaster
An easy way to accomplish what you want is to use the function scene.open
Code: Select all
scene.open("myscene.phz")

replace "myscene" with whatever the name if the next level is. Put that script into the end goal, such as a red block.

Re: create a game with different levels?

PostPosted: Tue Sep 15, 2009 12:30 pm
by Mystery
But then they would need to have the other scenes for it to work Which doesn't favor for online use.
The most common level system i've seen is the camera pan. For example you would have the first level in the bottom right corner of the sandbox then have the seconds level in the bottom left corner.

Code: Select all
Scene.Camera.Pan = [5,0]


This would put the camera 5 clicks to the right.

Code: Select all
Scene.Camera.Pan = [0,5]


this would put the camera 5 clicks up.
Negative numbers work the same way in the opposite direction.
Its best to toy around with it until you get the position you like

It also doesn't hurt the change zoom

Code: Select all
scene.camera.zoom = 150


150 is the default zoom setting
Once again its best to toy around with it to get the position you want.

To put this into oncollide its quite simple

Code: Select all
(e)=>{Scene.Camera.Pan = [0,0]; scene.camera.zoom = 150}

Re: create a game with different levels?

PostPosted: Tue Sep 15, 2009 11:58 pm
by Versieon
Yes, i did exactly that with my Simple Physics scenes, you can look at them to see it in action!