I want to make a game with three levels but no video shows that
Welcome to the forum! Try tagging CodeHelp for this stuff, like, things you need help with code on.
@CodeHelp, any ideas?
Start by designating a global variable to control the game’s level: Level
How you use the Level variable depends on the type of “levels” your game has:
Level ups may increase the pace of the game
This one is the easiest. Make the appropriate objects’ Speed trait a function of the game level. Something like this
where the exact formula would depend on the speeds you want.
The Set Speed block could be put in a Repeat Forever or When 7=7:
That’s usually just fine, but the Set Speed doesn’t need to execute every frame. That would be inefficient. Instead, we can create an object variable (self) Level that can be used to execute the Set Speed block only when the Level variable changes*:
Note* - this concept isn’t necessary here, but it’s a good practice and good to learn as it will be necessary in other scenarios.
Level ups may increase the numbers of enemies or obstacles
This is best to do with Clones. Once you have coded your enemies or obstacles using Clones, you simply need to increase the number of clones corresponding to the game level.
Choose only one of these examples, or use your own formula
- The 1st starts with 5 Obstacles at level 1 and increases by 2 for each level (5, 7, 9, 11…)
- The 2nd starts with 5 Obstacles at level 1 and increases by 50% for each level (rounding up) (5, 8, 12, 17…)
The new clones will follow the same setup as the existing clones. I recommend using a custom rule so the original object and all clones will get the same setup without having to repeat code:
where the code inside the custom rule is, of course, unique to every project. And, of course, there will be additional rules, as required, unique to every project. A complete explanation of using clones is beyond the scope of this topic.
Levels may have different setups or layouts
Here you may need 2 different types of rules. One that only runs once to setup the level, and one that runs continually during the level.
Put what ever code is appropriate for your specific project in the above conditionals/rules; set position or visibility in the 1 time rule, put a movement block in the continual rule, etc
Additionally, level ups (when you increase the value of Level) may occur for different reasons:
- time based
- score based (or any other objective measure e.g., distance traveled, number of kills, etc)
- upon completion of some objective e.g., eliminating all enemies on the level, reaching/touching an object that completes/changes the level, etc.
@boyboy Did this adequately cover the level based game you’re interested in? Be sure to check the details folders.
How do I set levels for a hopscotch game?
expanding on this, in your game you can have a sort of “win condition”. for example this could be if an object is touching something. when this so called win condition is achieved the level variable will increase.
if you’re trying to set up movement of objects during a levle change you can have something like "when level=2 set position (0,0), wait 500000000000. having a really long wait is a way to efectivly stop something from repeating. there’s probably a better way to do this but thats what i’ve don.
what is a detail folder? sorry i’m new to this
This . It’s called “Hide Details”. Tap the icon to expand the details.
This text will be hidden
This . It is called “Hide Details”. Tap the icon to expand the details. Great for when you need a spoiler (or, you can do this: This spoiler will be blurred) or to add details that will be too overwhelming when it is put in 1 or more line.
This text will be hidden
Can i send you my code? I am not understanding the concept. Sorry. I want to do score based levels. I wanna send you Dm
Post a link to your project and explain with as much clarity as possible what the problem is.
You should find many here willing to try and help.