Author Topic: Labels  (Read 1034 times)

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
Labels
« on: January 06, 2019, 07:43:07 PM »
Labels is a typical function in some coding that will be very useful in Platform Builder (Mostly on combining conditionals and in very large command prompts)

A label is set like this
Code: [Select]
=[label name]=
For example:
Code: [Select]
=Finish_game=

To call this label, will be like this
Code: [Select]
goto Finish_gameor
Code: [Select]
goto label Finish_game
What this does?
This will be useful because when we call a Label, the command prompts stops and instantly will start to execute commands from where the label is set in that command prompt.
For example
Code: [Select]
if score = 50
{
score - 50
goto Correct
}
exit
=Correct=
if lives > 5
{
# Commands here
}

If the label you go isn't in the command prompt set, the game continues the commands from where it started to go to the label, and just ignores it.

Sorry because my English is not very good because I'm Spanish ;) :P

CGM

  • Christian, 3D artist, former Platform Builder gamdev
  • Master Builder
  • *
  • Posts: 3836
    • View Profile
Re: Labels
« Reply #1 on: January 08, 2019, 12:02:23 AM »
Good thinking!