TGC Codebase Backup



Retro Sprite Designer by Chrissell

4th Jun 2018 16:49
Summary

Simple Retro Sprite Designer written in DBPro



Description

Ive been working on a painting program for a while and decided to make a sprite designer. Space key = draw pixel. Left click on colour palette to change colour.



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    Rem Project: SpriteDesignerTest 01
Rem Created: Saturday, June 02, 2018

Rem ***** Main Source File *****
rem *** Variables ***
x=40 : y=40 : col=10 :cs=0
rem *** Draw colour swatch boxes ***

for in = 1 to 34
	read a,b,c
	ink rgb(a,b,c),rgb(0,0,0)
	box 0,cs,20,cs+10
	cs=cs+10
next in
rem *** Load cursor image ***
load image "CursorBRW.bmp",3
Create Animated Sprite 3,"CursorBRW.bmp",3,1,3

sprite 3,x,y,3
play sprite 3,1,2,10
set sprite 3,1,1
rem *** Draw grid ***
//box 10,10,60,60
ink rgb(255,0,0),rgb(0,0,0)
for lx= 40 to 360 step 10
	line lx,40,lx,360
next lx
for ly=40 to 360 step 10
	line 40,ly,360,ly
next ly
sync
wait key

ink rgb(255,0,0),rgb(255,255,255)

rem *** main loop ***
do
	if rightkey()=1 and x<350 then x=x+10
	if leftkey()=1 and x>40 then x=x-10
	if upkey()=1 and y>40 then y=y-10
	if downkey()=1 and y<350 then y=y+10
	sprite 3,x,y,3
	play sprite 3,1,3,10
	
	if spacekey()=1 then box x,y,x+10,y+10
	if mouseclick()=1 then colour=point(mousex(),mousey()) : ink colour,rgb(255,255,255)
	wait 10
	
	rem *** make sprite and display ***
	get image 2,40,40,460,460 : set sprite 2,1,0 : sprite 2,450,100,2 : scale sprite 2,15 : show sprite 2 
	rem *** colour swatch change ***
	  	
	rem *** draw box with current colour ***
	box 40,0,60,20
	rem *** Save and Load image ***
	if inkey$()="s" then get image 4,40,40,360,360,1 : save image "Sprite1.bmp",4
    if inkey$()="l" then load image "sprite1.bmp",4 : sprite 5,40,40,4 : scale sprite 5,100 : // paste image 4,40,40,0
loop

wait key
end

rem *** Colour swatch data ***
data 255,3,3,255,33,3,241,61,7
data 218,247,166,255,195,0,255,87,51
data 199,0,57,144,12,63,88,24,69
data 7,79,247,7,247,149,113,247,7
data 247,202,7,247,142,7,247,99,7
data 161,161,161,97,97,97,107,0,66
data 33,132,41,8,41,107,132,0,82
data 107,107,33,0,107,132,255,255,255
data 000,000,000,255,0,0,148,214,57
data 8,49,148,214,49,148,255,255,66
data 99,198,22