Author Topic: Is there way to get a amount of items to end a stage?  (Read 1968 times)

Fi

  • Level 3: Plugger
  • *
  • Posts: 41
    • View Profile
Is there way to get a amount of items to end a stage?
« on: July 17, 2020, 07:10:56 PM »
So i want to make a game where you need a amount of items to end a stage, is there were to do it?

CGM

  • Christian, 3D artist, former Platform Builder gamdev
  • Master Builder
  • *
  • Posts: 3836
    • View Profile
Re: Is there way to get a amount of items to end a stage?
« Reply #1 on: July 17, 2020, 08:26:14 PM »
Fi, before I answer your question, I want to let you know what you're getting into with PB.

PB is an INCREDIBLE program. Unlike Mario Builder, PB is unbelievable in what it can do. It's not quite up to par with programs like Game Maker, but for what it can do without needing to learn complicated programming languages, you can do pretty much anything you'd like with it, as long as it doesn't involve things like complex physics, tilting ground tiles, and things like that. Pretty much anything can be done.

I strongly suggest you watch the new PB tutorial series which isn't even a week old to get you started with PB. The old video tutorials are so out of date, they're not worth wasting your time with. You can view them on the Official Platform Builder Website, here: https://theplatformbuilder.com/tutorials/


So to answer your question, of course there's a way to do what you'd like to do. As to how to do it...

You have 2 different ways you can do this. There's the old fashioned way which isn't used much anymore and is less versatile, and then there's the modern way which gives you a bit more options. I'll tell you both methods.

Method #1 (Old Fashioned)

In your item box, you can find what's called a Goal Stamp. Place the objects you would like the player to collect to complete the level, then place the goal stamp on them. In the area settings, in the box at top right corner, select Complete Goal Stamps. (You have to click on text to change stuff.) Then tell it that it completes the level.


Method #2 (Modern)

This method might seem difficult, but in all honesty, it's really easy. This method utilizes Command Prompt. Platform Builder's "programming language." TingThing says it's somewhere between a spoken language, and telling your phone what to do. In other words, really easy to learn. All you need to do is learn the commands. There's probably 400+ commands now plus variations etc, and it might seem overwhelming, so just do experiments and get used to using them.

In this instance, we want to use variables. Basically, a variable is a number stored on the computer which can be referenced later on. You can check if the number equals something to make PB do something.

First, create your item. Then, check the Command box, select it, then in the bottom right corner you'll see a command prompt box, click that, then type,


Var + (any name you want, EG: item_level_complete)

If var (any name you want, EG: item_level_complete) = (the number of items there are in your level)
{
complete course
}

You're telling PB that every time the item is collected, your variable adds 1 number to itself. Then you're asking if the variable equals the amount of items in your area (you'll have to manually count them.) Then you're saying that if that is the case, complete the course. And that's it!

Antikore

  • Developing Mortal Theater at day, developing depression at night.
  • Level 22: Trex
  • *
  • Posts: 2020
  • Enjoying Platform Builder from the very start
    • View Profile
    • PBuilder Resources
Re: Is there way to get a amount of items to end a stage?
« Reply #2 on: July 17, 2020, 08:53:47 PM »
Item code:
Code: [Select]
course var itemsToFinish + 1

Somewhere to check if we reached the required amount:
Code: [Select]
if course var itemsToFinish >= 10
{
//Your code here
}

Actually, if you feel enough pro you can actually do this to make the game run faster and with better fps
Code: [Select]
if course var itemsToFinish >= 10
area goal 1
then in the first area goal on the settings menu put an impossible area goal, for example find exit sign if you don't use it for anything and then add the commands for completing the level.

Using the least command lines as possible makes the game run way faster as PB doesn't need to read a lot of unnecessary lines which actually consumes a lot of cpu.
« Last Edit: July 17, 2020, 08:55:18 PM by Antikore »
Sorry because my English is not very good because I'm Spanish ;) :P

Fi

  • Level 3: Plugger
  • *
  • Posts: 41
    • View Profile
Re: Is there way to get a amount of items to end a stage?
« Reply #3 on: July 17, 2020, 10:29:39 PM »
i also want to make a hub world where you need stars to progress like in SM64 so is it possible in PB?

CGM

  • Christian, 3D artist, former Platform Builder gamdev
  • Master Builder
  • *
  • Posts: 3836
    • View Profile
Re: Is there way to get a amount of items to end a stage?
« Reply #4 on: July 17, 2020, 11:40:40 PM »
It sure is! Just say "game var" instead of just var. Var is short for variable, and just saying var tells PB it's an area variable. Meaning the variable will be reset to 0 once the area is left. There are also course variables. Meaning that the variables will be reset once a course is completed. Game variables mean that they aren't reset to 0 unless you tell PB to. To change a variable, just say, "var (var name) = (the number you want to change it to.)"

It's that simple! Have fun using PB!

Antikore

  • Developing Mortal Theater at day, developing depression at night.
  • Level 22: Trex
  • *
  • Posts: 2020
  • Enjoying Platform Builder from the very start
    • View Profile
    • PBuilder Resources
Re: Is there way to get a amount of items to end a stage?
« Reply #5 on: July 18, 2020, 09:27:54 AM »
i also want to make a hub world where you need stars to progress like in SM64 so is it possible in PB?
I have a perfect way to do that. I'm thinking on doing a tutorial for that. But anyways, if you want me to tell you the full system, we should talk on Discord as I'm pretty far more confortable there.
Sorry because my English is not very good because I'm Spanish ;) :P

Fi

  • Level 3: Plugger
  • *
  • Posts: 41
    • View Profile
Re: Is there way to get a amount of items to end a stage?
« Reply #6 on: July 22, 2020, 04:30:15 PM »
Is there also a way to be area interconnected items to end a level and I don't know if that makes but

CGM

  • Christian, 3D artist, former Platform Builder gamdev
  • Master Builder
  • *
  • Posts: 3836
    • View Profile
Re: Is there way to get a amount of items to end a stage?
« Reply #7 on: July 22, 2020, 07:00:27 PM »
I don't understand the question.

Fi

  • Level 3: Plugger
  • *
  • Posts: 41
    • View Profile
Re: Is there way to get a amount of items to end a stage?
« Reply #8 on: July 22, 2020, 07:04:22 PM »
I mean like getting Items in different areas and finishing the level in a later part

I probably still doesn't make sense but I am really trying

CGM

  • Christian, 3D artist, former Platform Builder gamdev
  • Master Builder
  • *
  • Posts: 3836
    • View Profile
Re: Is there way to get a amount of items to end a stage?
« Reply #9 on: July 22, 2020, 09:25:22 PM »
Oh, as long as at the end of the level you define that it's the end of the level/course, you can use a course variable. Just say course var instead of var or game var. The variable will reset to 0 once the course is complete. That way, you can replay the course without it breaking.