Type your ugBASIC program here (remember: keywords like PRINT must be UPPERCASE!).
Click on Build menu to select the target: you will download the compiled binary file!

REM Note that this example will be executed everywhere REM BUT Commodore VIC-20 and Philips VG5000. PROCEDURE example ON ALL BUT VIC20, VG5000 BITMAP ENABLE(16) DEFINE PALETTE NOT PRESERVE CLS BLACK mask := LOAD IMAGE("blit_mask.png") EXACT TRANSPARENCY BLACK OPACITY LIGHT WHITE background := LOAD IMAGE("blit_background.png") sprite := LOAD IMAGE("blit_sprite.png") CONST x = ( SCREEN WIDTH - IMAGE WIDTH(background) ) \ #2 CONST y = ( SCREEN HEIGHT - IMAGE HEIGHT(background) ) \ #2 PUT IMAGE background AT x,y REM In the first blit, the mask is blitted onto the background using REM the raster operator AND. Because any value ANDed with 0 equals 0, REM and any value ANDed with 1 is unchanged, black areas are created REM where the actual sprites will appear, while leaving the rest of REM the background alone. BLIT bop1 AS ( ( SOURCE ) AND ( DESTINATION ) ) BLIT IMAGE mask AT x+10,y+10 WITH bop1 REM In the second blit, the sprite is blitted onto the newly altered REM background using the raster operator of OR. Because any value REM ORed with 0 is unchanged, the background is unaffected and the REM black areas are filled with the actual sprite image. BLIT bop2 AS ( ( ( INVERSE ( SOURCE 2 ) ) AND ( SOURCE 1 ) ) OR ( DESTINATION ) ) BLIT IMAGES sprite, mask AT x+10,y+10 WITH bop2 END PROC CALL example ON ALL BUT VIC20, VG5000

Welcome to the ugBASIC sandbox!

This tool was designed to quickly test whether the code you are writing compiles correctly and determines the desired results. Since the source is compiled thanks to dedicated servers, separate from the browser you are using, some commands are not available: for example, you cannot load external files or resources by using the LOAD command. If you need to develop a program with a complete tool, we recommend installing the executables or the UGBASIC-IDE.

Unless required by applicable law or agreed to in writing, this website is given on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.