Open Surge Forum

A fun 2D retro platformer inspired by Sonic games and a game creation system

You are not logged in.

Announcement

Our community has moved to Discord! https://discord.gg/w8JqM7m

#1 2013-10-28 23:23:41

MatheusRRR
Member
From: Rio de Janeiro, Brazil
Registered: 2012-10-05
Posts: 335
Website

[suggestion] Custom Variable

"custom1"
"custom2"
(...)

custom(1)
custom(2)
(...)

exemple:

// ------------------------------------------------------------
// Open Surge Engine 0.2.0 level
// This file was generated by the built-in level editor.
// ------------------------------------------------------------

// header
name "Jungle Hill"
author "MatheusRRR"
version "1.0"
requires 0.2.0
act 1
theme "themes/crisis_city.brk"
bgtheme "themes/crisis.bg"
spawn_point 16 288
music "musics/crisis.ogg"
grouptheme "themes/crisis.grp"
startup ".fire_crysis_startup"
players "Silver" "Blaze"
custom1 "images/1.png" <============
(...)

This command can store variables for the specific level.
Suppose the "custom1" has the value "icon_level1.png" and hud has a command to display the icon for specific level. Depending on the value of "custom variable", each level may have a different icon.

this suggestion will be useful for the game? tongue

Offline

#2 2013-10-28 23:24:25

aronthehedgehog
Member
From: Lincoln, NE
Registered: 2013-04-05
Posts: 390

Re: [suggestion] Custom Variable

oh coool! i like that. big_smile


Not active much anymore.
The only things I do now is just let inspiration come to me when it's needed.
Also bad profile pic because I don't have anything else in mind.

Offline

#3 2013-10-30 02:08:44

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,300
Website

Re: [suggestion] Custom Variable

hmmmmm, you can do that already, can't you? smile

We usually define strings in the language files (.lng). That said, you could have an entry like

TEXT1_LEVEL1        "hello!"

then, in the .lev file, you'd have:

startup ".fire_crysis_startup" ".level1_startup"

where .level1_startup would set some global $_LEVELID to one (or two, or three...). Finally, when you want to access you TEXT1_LEVEL? string, in any level, you print $TEXT1_LEVEL$_LEVELID.

Offline

#4 2013-10-30 14:51:29

MatheusRRR
Member
From: Rio de Janeiro, Brazil
Registered: 2012-10-05
Posts: 335
Website

Re: [suggestion] Custom Variable

that might work, but with the custom variable would save time and space. Suppose an object specific to each level he walk "ypos" a certain height for other, with a certain speed. looks simple but is not. if we make the object, each phase would have the startup logging, but it all by code. In the case of custom variable, he would record these variables without using objects, leaving the game in less space.

example "using objects"

// ------------------------------------------------------------
// Open Surge Engine 0.2.0 level
// This file was generated by the built-in level editor.
// ------------------------------------------------------------

// header
name "Jungle Hill"
author "MatheusRRR"
version "1.0"
requires 0.2.0
act 1
theme "themes/crisis_city.brk"
bgtheme "themes/crisis.bg"
spawn_point 16 288
music "musics/crisis.ogg"
grouptheme "themes/crisis.grp"
startup ".fire_crysis_startup" ".levels_startup"
players "Silver" "Blaze"
(...)

+

object ".levels_startup"
{
    requires 0.2.0
    
    state "main"
    {
        if "level()=a" and "act()=b" "ab"
        if "level()=a" and "act()=c" "ac"
(...)
    }
}

example "using custom variable"

// ------------------------------------------------------------
// Open Surge Engine 0.2.0 level
// This file was generated by the built-in level editor.
// ------------------------------------------------------------

// header
name "Jungle Hill"
author "MatheusRRR"
version "1.0"
requires 0.2.0
act 1
theme "themes/crisis_city.brk"
bgtheme "themes/crisis.bg"
spawn_point 16 288
music "musics/crisis.ogg"
grouptheme "themes/crisis.grp"
startup ".fire_crysis_startup"
players "Silver" "Blaze"
custom1 "images/1.png" <============
(...)

only

Offline

#5 2013-11-01 03:53:18

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,300
Website

Re: [suggestion] Custom Variable

hmmm, it has just occurred that there's an even simpler thing! How about this:

1) You're dealing with strings here, correct? Define your custom strings in the .lng file - as you probably know, all strings are defined there.

CUSTOM1_sunshine      "abc"
CUSTOM1_waterworks    "xyz"

only this

2) You don't need a bunch of startup objects, nor to deal with a lot of code. Just access that string when you need it.
Suppose that there's some $LEVEL_FILE set to "sunshine" or "waterworks", automatically (there isn't, right now, but there could be). Then, accessing your string is a matter of printing

$CUSTOM1_$LEVEL_FILE

very simple!! smile

does that help?

Offline

#6 2013-11-01 16:00:42

MatheusRRR
Member
From: Rio de Janeiro, Brazil
Registered: 2012-10-05
Posts: 335
Website

Re: [suggestion] Custom Variable

yes, u are right. tongue

Offline

Board footer

Powered by FluxBB  hosted by tuxfamily.org