Author Topic: Idea for optimization, tags  (Read 1243 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
Idea for optimization, tags
« on: February 27, 2022, 01:05:04 PM »
In my game there is a lot of stacked stuff and that's bad. For example, item randomizers or enemy killers.
Example:
Code: [Select]
// This would be an item randomizer in my game
local var i = random 10
if i = 1
spawn item 1, self
if i = 2
spawn item 2, self
// ...

What if, instead of doing this, I could create a custom tag, hold all the items on it, and use just a few commands
Code: [Select]
spawn random tag 1, 1

Tags would have their own category on the game manager, and they will hold items, enemies, projectiles, blocks, etc.
Example with the enemies, instead of having an item that kills enemies with a command for each enemy, it would be like this
Code: [Select]
// Tag with ID 2, kill all enemies from it
kill tag 2

Most commands used for interact with any of the objects that tags can hold may be usable to interact with tags too.
This would be useful too for cleaning the code a bit
Sorry because my English is not very good because I'm Spanish ;) :P

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: Idea for optimization, tags
« Reply #1 on: February 28, 2022, 02:59:51 PM »
Addition to this suggestion: Tag variables and areas too, so I can set a bunch of different variables to a same value with an ease, and to change area to a random area from the tag
Sorry because my English is not very good because I'm Spanish ;) :P