Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - n00b

Pages: [1]
1
Games / Side-Scrolling platformer demo
« on: 29. August 2016, 08:48:31 »
This is just a demo I put together to test out some stuff for the game I am working on. It is just a small level but it does scroll to follow the character and you can jump and collide with the walls. The art assets come from RPG maker as I havent started working on the art yet. It is already compiled, so all you have to do is pass engine.cbc to rcbasic_run and it should start. (Make sure you have the most recent version of rcbasic). The source code for the demo is in the src folder if you want to look at it.

Press b to jump.

2
General questions and discussions / Looking for a new License
« on: 05. May 2016, 08:17:15 »
I am getting ready to upload a new release later today with a lot of fixes and improvements.  I have been looking over my current license and I realize that it requires any program written in RCBasic to distribute a copy of the MIT License with it.  Is there a open source license that will allow my users to not have to distribute a license with there works?

3
I finally got a new version up along with linux support.  And I fixed a few bugs in the android port as well.  Check it out at http://www.rcbasic.com.  I am also still working on the BASIC dialect series and should have another video up this weekend.

4
About dialect development / BASIC Dialect from scratch
« on: 18. April 2016, 08:17:07 »
I am still at the video series, but someone from the sdlBasic forums wanted to know if I would make a video on creating a BASIC dialect so I decided to do it.  I am having to split it up into multiple videos as it is a lot of info to cover.  I have posted the first video here: https://youtu.be/vmN2HBBXK4Y.  Sorry for the bad quality but youtube can seem to keep this video at the quality I recorded it at.  Anyone who watches it let me know what you think.

Here is the code from the video:
Code: [Select]
#include <iostream>
#include <string>

using namespace std;

string keywords[]=
{
    "IF",
    "THEN",
    "ELSE",
    "FOR",
    "NEXT",
    "STEP",
    "TO",
    "DO",
    "LOOP",
    "WHILE",
    "UNTIL",
    "WEND",
    "GOTO",
    "DEF",
    "PRINT",
    "INPUT",
    "REM",
    "END"
};

int keyword_count = 18;

string spChars[]=
{
    "^",
    "&",
    "*",
    "(",
    ")",
    "-",
    "+",
    "=",
    "[",
    "]",
    "\"",
    "<",
    ">",
    ",",
    " "
};

int spChar_count = 15;

string tokens[100];
int token_count = 0;

bool isSpecialCharacter(string c)
{
    for(int i = 0; i < spChar_count; i++)
    {
        if(c.compare(spChars[i])==0)
            return true;
    }
    return false;
}

bool isNumber(string c)
{
    if(c.compare("0")==0 || c.compare("1")==0 || c.compare("2")==0 || c.compare("3")==0 || c.compare("4")==0 ||
       c.compare("5")==0 || c.compare("6")==0 || c.compare("7")==0 || c.compare("8")==0 || c.compare("9")==0)
        return true;
    return false;
}

bool tokenizer(string src_line)
{
    token_count = 0;
    src_line += " ";
    string src_token = "";
    for(int i = 0; i < src_line.length(); i++)
    {
        if(!isSpecialCharacter(src_line.substr(i,1)))
        {
            if(isNumber(src_line.substr(i,1)))
            {
                src_token = "<num>";
                int d = 0;
                for(; i < src_line.length(); i++)
                {
                    if(isNumber(src_line.substr(i,1)))
                    {
                        src_token += src_line.substr(i,1);
                    }
                    else if(src_line.substr(i,1).compare(".")==0)
                    {
                        if(d==0)
                            src_token += ".";
                        else
                        {
                            cout << "Can only have one decimal in a number" << endl;
                            return false;
                        }
                    }
                    else if(isSpecialCharacter(src_line.substr(i,1)))
                    {
                        break;
                    }
                    else
                    {
                        return false;
                    }
                }
                tokens[token_count] = src_token;
                token_count++;
                src_token = "";
                i--;
            }
            else
            {
                src_token = "<id>";
                for(; i < src_line.length(); i++)
                {
                    if(isSpecialCharacter(src_line.substr(i,1)))
                        break;
                    else
                        src_token += src_line.substr(i,1);
                }
                tokens[token_count] = src_token;
                token_count++;
                src_token = "";
                i--;
            }
        }
        else if(src_line.substr(i,1).compare("\"")==0)
        {
            //cout << "DEBUG: " << i << endl;
            bool str_close = false;
            src_token = "<string>";
            for(i=i+1; i < src_line.length(); i++)
            {
                if(src_line.substr(i,1).compare("\"")==0)
                {
                    //cout << "someting" << endl;
                    str_close = true;
                    break;
                }
                else
                    src_token += src_line.substr(i,1);
                //cout << "str: " << src_line.substr(i,1) << endl;
            }
            if(str_close == false)
            {
                cout << "Did not close string" << endl;
                return false;
            }
            tokens[token_count] = src_token;
            token_count++;
            src_token = "";
        }
        else if(src_line.substr(i,1).compare("+")==0)
        {
            tokens[token_count] = "<add>";
            token_count++;
        }
        else if(src_line.substr(i,1).compare("-")==0)
        {
            tokens[token_count] = "<sub>";
            token_count++;
        }
        else if(src_line.substr(i,1).compare("*")==0)
        {
            tokens[token_count] = "<mul>";
            token_count++;
        }
        else if(src_line.substr(i,1).compare("/")==0)
        {
            tokens[token_count] = "<div>";
            token_count++;
        }
        else if(src_line.substr(i,1).compare("^")==0)
        {
            tokens[token_count] = "<pow>";
            token_count++;
        }
        else if(src_line.substr(i,1).compare("(")==0)
        {
            tokens[token_count] = "<par_open>";
            token_count++;
        }
        else if(src_line.substr(i,1).compare(")")==0)
        {
            tokens[token_count] = "<par_close>";
            token_count++;
        }
        else if(src_line.substr(i,1).compare("[")==0)
        {
            tokens[token_count] = "<square_open>";
            token_count++;
        }
        else if(src_line.substr(i,1).compare("]")==0)
        {
            tokens[token_count] = "<square_close>";
            token_count++;
        }
        else if(src_line.substr(i,1).compare("=")==0)
        {
            tokens[token_count] = "<equal>";
            token_count++;
        }
        else if(src_line.substr(i,1).compare("&")==0)
        {
            tokens[token_count] = "<amp>";
            token_count++;
        }
        else if(src_line.substr(i,1).compare(",")==0)
        {
            tokens[token_count] = "<sep>";
            token_count++;
        }
        else if(src_line.substr(i,1).compare("<")==0)
        {
            tokens[token_count] = "<less>";
            if(src_line.substr(i).length() > 1)
            {
                if(src_line.substr(i,2).compare("<=")==0)
                    tokens[token_count] = "<less_equal>";
                else if(src_line.substr(i,2).compare("<>")==0)
                    tokens[token_count] = "<not_equal>";
            }
            token_count++;
        }
        else if(src_line.substr(i,1).compare(">")==0)
        {
            tokens[token_count] = "<greater>";
            if(src_line.substr(i).length() > 1)
            {
                if(src_line.substr(i,2).compare("<=")==0)
                    tokens[token_count] = "<greater_equal>";
            }
            token_count++;
        }
    }
    return true;
}

int main()
{
    string src_line = "";
    while(src_line.compare("exit")!=0)
    {
        cout << "->";
        getline(cin, src_line);
        tokenizer(src_line);
        for(int i = 0; i < token_count; i++)
            cout << tokens[i] << endl;
        cout << endl;
    }
    return 0;
}

5
Community news and announcements / RC Basic Video Series
« on: 13. April 2016, 08:45:08 »
I started doing a video series on programming with RC Basic.  The link is here https://www.youtube.com/playlist?list=PLIUOwQ2sQmXLJOTCZ6w5XWsI5uesbUGbG

My goal is to eventually start covering some graphics techniques like tile scrolling and alpha blending but right now I am just doing videos on beginner topics.

Pages: [1]