locked
Small Basic Classes RRS feed

  • Question

  • Hi! I want to make a bit larger game than I have before, maybe like a invaders game or something like that, but I would like to know if there is any way to call other Small Basic code classes (if you consider another .SB file as a class) from a main program. For example if you get hit, the main program would call "playerHit.SB", and run the code in it without any type of TextWindow or GUI. I know I can just include the code in the main program itself, but I would really like it because it is really easy to edit individual classes to control certain characters. Like in MineCraft.

    -Noah J. Buscher "Nothing is Impossible Until Proven Impossible."

    Wednesday, September 19, 2012 9:33 PM

Answers

  •     Even though SB's categories (GraphicsWindow, Math, Shapes, Control, etc) are based on object oriented paradigm idea; SB itself doesn't provide any means to create our own class objects.
        If you look at it, w/o local scope variables, that would be meaningless anyways!!! It's a pity such narrow decision was taken for SB.  =(
        But I believe there are some extensions which allow an SB program to call others to run together. In this way, I guess each one would have their own "local" variables, and even their own GraphicsWindow & TextWindow screens!
        I've never tested them, but if they work as I imagine them so, they would run asynchronously from each other.
        Now, for them to communicate to each other, a shared file would be enough.
        Even if all that would be true, I advise you against calling another SB program to deal with things which demand speed!
        Such "playerHit.exe" type calls would slow a game down a lot, I daresay!
        Parallel running would be advantageous if tasks would be split between them, like one does the math processing, and the other displays the graphics, and so on.
        Well, these are my thoughts!  ^_^

    Click on "Propose As Answer" if some post solves your problem or "Vote As Helpful" if some post has been useful to you! (^_^)

    Wednesday, September 19, 2012 10:45 PM
    Answerer

All replies

  • Hello.

    I was wondering the same thing a while back. the only solution I found to something like this would be an extension called SayPlus. It Has some stuff in it to call a TXT with some small basic code in it. I found all this stuff here:

    http://social.msdn.microsoft.com/Forums/en-US/smallbasic/thread/183cd666-af02-4298-a3ef-c8dd012fa72a


    One thing that is impossible is impossible no matter if it is proven so first.

    Wednesday, September 19, 2012 10:11 PM
    Answerer
  •     Even though SB's categories (GraphicsWindow, Math, Shapes, Control, etc) are based on object oriented paradigm idea; SB itself doesn't provide any means to create our own class objects.
        If you look at it, w/o local scope variables, that would be meaningless anyways!!! It's a pity such narrow decision was taken for SB.  =(
        But I believe there are some extensions which allow an SB program to call others to run together. In this way, I guess each one would have their own "local" variables, and even their own GraphicsWindow & TextWindow screens!
        I've never tested them, but if they work as I imagine them so, they would run asynchronously from each other.
        Now, for them to communicate to each other, a shared file would be enough.
        Even if all that would be true, I advise you against calling another SB program to deal with things which demand speed!
        Such "playerHit.exe" type calls would slow a game down a lot, I daresay!
        Parallel running would be advantageous if tasks would be split between them, like one does the math processing, and the other displays the graphics, and so on.
        Well, these are my thoughts!  ^_^

    Click on "Propose As Answer" if some post solves your problem or "Vote As Helpful" if some post has been useful to you! (^_^)

    Wednesday, September 19, 2012 10:45 PM
    Answerer
  • I know I can just include the code in the main program itself, but I would really like it because it is really easy to edit individual classes to control certain characters.

    If you put some big title comments to clarify when a set of subroutine type begins, name subs & variables w/ fitting descriptions, space out between code blocks dealing w/ a particular task, etc; that would make your code easy to read, and therefore, to modify!


    Click on "Propose As Answer" if some post solves your problem or "Vote As Helpful" if some post has been useful to you! (^_^)

    Wednesday, September 19, 2012 10:56 PM
    Answerer
  • True. :)

    -Noah J. Buscher "Nothing is Impossible Until Proven Impossible."

    Wednesday, September 19, 2012 11:13 PM
  • Now, there is an extension which has some new options for games.

    I think it is the SayPlus! Extension.


    Ich bin Neu

    Thursday, September 20, 2012 2:42 PM