trying to make a graphic to text exporter. i think it's simple, but still beyond my knowledge

Not favoritedFavorited Favorited 0 favourites
  • 4 posts
From the Asset Store
It's here!
$4.95 USD
Creepy and nasty horror track. It's terrifying from the beginning till the end. Goosebumps guaranteed
  • OK so i'm making a tool for an old computer language i'm learning.. I'm learning to make games for the Intellivision using a language called "IntyBasic" which is basically a modern take on assembly for this system. Offers various enhancements to make coding for the Intellivision easier / faster.

    In this language to define an 8x8 pixel graphic, you do it like this:

    BITMAP "########"

    BITMAP "########"

    BITMAP "........"

    BITMAP "........"

    BITMAP "........"

    BITMAP "........"

    BITMAP "........"

    BITMAP "........"

    the # is a pixel and a . is empty space.

    So what i want to do is make it so when i click "ok" it checks each of my boxes to see if it's a 0 or a 1..

    then output the info in a text field so that it is like above.. with "Bitmap" and " and another " at the end so someone can just drag / highlight all the code and paste it into the code..

    I just don't know how to work with outputting text like that. I am sure that arrays would be needed, but i've never been great with them and then the formatting on top of that. very daunting.

    I thought it would be a useful tool for the Intellivision community of homebrew developers.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I think you can easily do it without an array. Give your pixel sprites two instance vars: “id” (integer and set it on all sprites from 1 to 64) and “pixel” (string - either “.” or “#”). Then on click pixel sprite, toggle its animation and the value for pixel. In the same on click, clear the text then do a “for each ordered by id” loop on your sprites and append the value of pixel to the text.

    Importantly, also append

    ”””BITMAP “

    before the value for pixel if id mod 7 = 1, and:

    “””” &newline

    afterwards if id mod 7 = 0

    Note the double quotes - to allow you to put quote marks in a string.

    (Edit - fixed the newline being in the wrong place!)

  • If the squares are sprites it’s just a matter of looping over them in order. You can use “for each ordered” to do that or if you placed the instances in a specific order then a normal “for each” could work.

    One way to do the events could look like this:

    Var out=“”
    Var x=0
    Var y=0
    
    On button clicked
    — set out to “”
    
    On button clicked
    For each sprite ordered by 1000*sprite.y+sprite.y ascending
    — set x to loopindex%8
    — set y to int(loopindex/8)
    — add (x=0)?”BITMAP “””:”” to out
    — add sprite.animationFrame=0?”.”:”#” to out
    — add (x=7)?””””&newline:”” to out

    Or basically loop over the squares a row at a time and output a . Or a # depending on the frame. Then, as citron mentioned, just add the Bitmap, quotes and newline when at the start or end of a row.

  • OK that's awesome! Thank you for explaining that so well. This will be very helpful!

    Sincerely,

    Caleb

Jump to:
Active Users
There are 0 visitors browsing this topic (0 users and 0 guests)