create a game with different levels?

About advanced scenes, and the Thyme scripting language used in Algodoo.

create a game with different levels?

Postby spook1 » Tue Sep 15, 2009 7:17 am

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
spook1
 
Posts: 20
Joined: Thu Sep 10, 2009 12:06 am

Re: create a game with different levels?

Postby standardtoaster » Tue Sep 15, 2009 7:26 am

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.
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: create a game with different levels?

Postby Mystery » Tue Sep 15, 2009 12:30 pm

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}
User avatar
Mystery
 
Posts: 2802
Joined: Thu Sep 03, 2009 1:16 pm
Location: Southern Australia

Re: create a game with different levels?

Postby Versieon » Tue Sep 15, 2009 11:58 pm

Yes, i did exactly that with my Simple Physics scenes, you can look at them to see it in action!
User avatar
Versieon
 
Posts: 375
Joined: Tue Sep 01, 2009 4:45 pm


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 1 guest

cron