_____ _ ___ _ _ _ |_ _| |__ ___ / _ \ _ _| |_ ___ _ __| | (_)_ __ _ ___ __ | | | '_ \ / _ \ | | | | | | __/ _ \ '__| | | | '_ \| | | \ \/ / | | | | | | __/ |_| | |_| | || __/ | | |___| | | | | |_| |> < |_| |_| |_|\___|\___/ \__,_|\__\___|_| |_____|_|_| |_|\__,_/_/\_\
Last updated: 2020/07/01
Using the img2bbc Python script, you can convert an image into BBC Micro or BBC BASIC V friendly DATA arrays. A preview file and a plain text *.DAT file are created in which you can either copy/paste the inside text to a project (such as if using 'brandy') or use it some other way. However, this script is only meant to help with creating small sprites. BBC BASIC will run the created array just fine as long as each line is 160 characters (including the "DATA" and commas) or less. BBC BASIC V (such as using 'brandy') will allow 1024 characters per line.
Run via 'python /path/to/img2bbc.py' and follow the instructions from there.
MODE 5 CLS STARTX=0 STARTY=0 ZOOM=7 FOR Y = 38 TO 1 STEP -1 FOR X = 1 TO 75 READ DotColor GCOL 0,DotColor MOVE X+STARTX,Y+STARTY PLOT 65,X*ZOOM+STARTX,Y*ZOOM+STARTY NEXT X NEXT Y DATA ... 'Copy/paste from DAT file DATA ... 'So on and so forth...
The reason the FOR loop for Y uses STEP -1 is because a coordinate of 0,0 on a BBC Micro is the bottom left corner, similar to that of how a graph works like you have learned in school. The "38" part is the height of the sprite and the "75" part is the width of the sprite. The "DotColor" part can uses READ to store the array into the variable "DotColor," but you can name it whatever you want. If commas were not required for arrays, the width could be almost double. ZOOM is so you can actually tell what the graphic is on a BBC Micro. In BBC BASIC, DATA arrays are traditionally placed at the end of a FOR loop.