Wow so many posts!
@Irojo
To make make the editor mouse controled, replace
if upkey()=1 and py>0 and disable=0 then dec py,32:disable=1
if downkey()=1 and py<416 and disable=0 then inc py,32:disable=1
if rightkey()=1 and px<416 and disable=0 then inc px,32:disable=1
if leftkey()=1 and px>0 and disable=0 then dec px,32:disable=1
if disable=1 then inc wait,1
if wait=80 then disable=0:wait=0
with
px=mousex()/32*32
py=mousey()/32*32
if px>416 then px=416
if py>416 then py=416
[EDIT]
OK Irojo, I have sorted out and indented you entire code. I used
rem for Remarks and comments and
` for temporarily removed code.
The Game (or whatever):
rem Image Number List
rem 1. Cleared Ground.
rem 2. Uncleared Ground.
rem 3. Stone
rem 4. Gems
rem 5. The Player
sync on
sync rate 0
rem Create an array
dim terrain(196)
rem Set the arrays random. This is only for the example, and will not be kept.
for set=1 to 196
terrain(set)=rnd(3)
`terrain(set)=1
next set
rem Make a box for the player.
ink rgb(255,0,0),0
box 0,0,32,32
rem Get the image.
get image 5,0,0,32,32
cls
rem Make a box for cleared ground.
ink rgb(155,155,155),0
box 0,0,32,32
rem Get the image.
get image 1,0,0,32,32
cls
rem Make a box for uncleared ground.
ink rgb(15,155,15),0
box 0,0,32,32
rem Get the image.
get image 2,0,0,32,32
cls
rem Make a box for stone
ink rgb(40,40,40),0
box 0,0,32,32
rem Get the image.
get image 3,0,0,32,32
cls
rem Make a box for gems
ink rgb(100,75,200),0
box 0,0,32,32
get image 4,0,0,32,32
cls
rem Increasing the y so no sprites are overlapped. Mainly making it a 14x14 grid
for times=1 to 14
rem taking care of the 14 square row, while also pasting the sprites
for n=1 to 14
inc order,1
rem Placing the sprites, which have been chosen instead of image.
if terrain(order)=0 then sprite order,x,y,1
if terrain(order)=1 then sprite order,x,y,2
if terrain(order)=2 then sprite order,x,y,3
if terrain(order)=3 then sprite order,x,y,4
rem Increase the position, without overlapping the sprites.
inc x,32
rem sync
rem Go to next round
next n
rem Increasing y, and setting x to 0.
inc y,32
x=0
rem Go to next round of loop
next times
hide mouse
ink rgb(255,255,255),0
set text opaque
do
rem FPS Display
center text 500,240," "+str$(screen fps())+" "
rem FPS Display - remove from final
rem Show the player
sprite 1000,px,py,5
rem Show the Gems Collected:
center text 240,450," Gems Collected:"+str$(gemsc)
rem =Control the player=
if upkey()=1 and py>0 and disable=0 then dec py,32:disable=1:lh=scancode()
if downkey()=1 and py<416 and disable=0 then inc py,32:disable=1:lh=scancode()
if rightkey()=1 and px<416 and disable=0 then inc px,32:disable=1:lh=scancode()
if leftkey()=1 and px>0 and disable=0 then dec px,32:disable=1:lh=scancode()
rem |=Control the player=|
rem Collision Detection
for any=1 to 196
if sprite collision(any,1000)>0
rem Get the sprites image number.
si=sprite image(any)
rem If the ground is uncleared,then make it cleared.
if si=2 then sprite any,px,py,1
rem If the ground is gems, then increase the gem count, and make it cleared ground.
if si=4 then inc gemsc,1:sprite any,px,py,1
rem If it is rock, then start the redirect.
if si=3 then redirect=1
endif
rem FPS Display
rem Redirect : This sends it to the old position.
if redirect=1
if lh=205 then dec px,32:lh=0:redirect=0
if lh=203 then inc px,32:lh=0:redirect=0
if lh=208 then dec py,32:lh=0:redirect=0
if lh=200 then inc py,32:lh=0:redirect=0
endif
`center text 500,240," "+str$(screen fps())+" "
rem FPS Display - remove from final
next any
rem |Collision Detection|
rem Handling timer to slow the player down.
if disable>=1 then inc disable,1
if disable=8 then disable=0
rem ---------------------------------------
if spacekey()=1 then exit
rem ^^^^^^^^^^^^^^ - remove from final
sync
loop
rem |Main Loop|
rem Delete all sprites, and display them being deleted for effects.
cls
set text size 40
set text font "VAIO"
center text 220,130,"Gem Count:"+str$(gemsc)
center text 220,240,"You have "+str$(lives)+" lives left."
delete sprite 1000
rem Shrinking and removing sprites.
for remove=1 to 196
if sprite exist(remove)
n=100
repeat
scale sprite remove,n
dec n,15
sync
until n=10
delete sprite remove
endif
sync
next remove
sync rate 30
rem |Delete all sprites, and display them being deleted for effects.|
wait key
rem |wait for a key press. - remove from final
And the editor (with mouse control):
rem Image Number List For other Program
rem 1. Cleared Ground.
rem 2. Uncleared Ground.
rem 3. Stone
rem 4. Gems
rem 5. The Player
rem ---
rem ---
rem Image Number List For THIS Program
rem 1. Empty Box.
rem 2. Empty Box. Basically the cursor.
rem 3. Cleared Ground.
rem 4. Uncleared Ground.
rem 5. Stone
rem 6. Gems
rem 7. Asterick symbol
rem Level Editor Attempt.
sync on
sync rate 0
r=1
rem Make the moving symbol
ink rgb(100,75,200),0
set text size 60
center text 545,115,"*"
get image 7,530,50,620,170
cls
rem Make a box for cleared ground.
ink rgb(155,155,155),0
box 0,0,32,32
rem Get the image.
get image 3,0,0,32,32
cls
rem Make a box for uncleared ground.
ink rgb(15,155,15),0
box 0,0,32,32
rem Get the image.
get image 4,0,0,32,32
cls
rem Make a box for stone
ink rgb(40,40,40),0
box 0,0,32,32
rem Get the image.
get image 5,0,0,32,32
cls
rem Make a box for gems
ink rgb(100,75,200),0
box 0,0,32,32
get image 6,0,0,32,32
rem Making the array
dim terrain(196)
rem ---
cls
ink rgb(255,255,255),0
line 0,0,31,0
line 0,0,0,31
line 31,0,31,31
line 0,31,31,31
get image 1,0,0,32,32
cls rgb(100,100,100)
box 0,0,32,32
get image 2,0,0,32,32
for l=1 to 14
for r=1 to 14
paste image 1,x,y
inc x,32
next r
x=0
inc y,32
next l
sync
inum=1
rem Make 'Barriers'.
line 0,448,448,448
line 448,448,448,0
set text size 20
spritex#=525
spritey#=50
do
sprite 2,px,py,2
sprite 1,spritex#,spritey#,7
px=mousex()/32*32
py=mousey()/32*32
if px>416 then px=416
if py>416 then py=416
if inkey$()="1" then paste image 3,px,py
if inkey$()="2" then paste image 4,px,py
if inkey$()="3" then paste image 5,px,py
if inkey$()="4" then paste image 6,px,py
rem Makes a button that fills the screen with uncleared.
if button(480,260,610,280,"Fill with Uncleared",1)=2
l=0:r=0:x=0:y=0
for l=1 to 14
for r=1 to 14
paste image 4,x,y
inc x,32
next r
x=0
inc y,32
next l
endif
if spacekey()=1 then exit
text 0,(416+screen height())/2,"Use the arrow keys to move, 1-4 to place terrain, and press the Spacebar to save data."
ink rgb(155,155,155),0
box 495,100,545,170
ink rgb(15,155,15),0
box 495,100,515,170
set text size 40
ink rgb(255,255,255),0
center text 545,100,"Terrain"
ink rgb(255,255,255),0
center text 545,140,"Builder"
set text size 10
spritex#= sin(dg)*.02 +spritex#
spritey#= cos(dg)*.02 +spritey#
inc rotate,1
if rotate=5 then inc dg,1:rotate=0
if dg=360 then dg=0
sync
loop
rem This will get the array data
text 470,420,"Scanning..."
x=0:y=0:set=0
for y=1 to 448 STEP 32 : rem Use STEP
for x=1 to 448 STEP 32 : rem Use STEP
inc set,1
color=point(x,y)
if rgbr(color)=148 and rgbg(color)=153 and rgbb(color)=148 then terrain(set)=1
if rgbr(color)=8 and rgbg(color)=153 and rgbb(color)=8 then terrain(set)=2
if rgbr(color)=32 and rgbg(color)=36 and rgbb(color)=32 then terrain(set)=3
if rgbr(color)=98 and rgbg(color)=72 and rgbb(color)=197 then terrain(set)=4
if terrain(set)=0 then terrain(set)=2
rem Use STEP in the for loop instead
`inc x,32
sync
next x
rem Use STEP in the for loop instead
`inc y,32
`x=0
next y
text 470,420,"Scanning...Complete."
hide sprite 2
hide sprite 1
wait 1000
cls rgb(100,100,100)
rem This is where we'll need to save it to a file.
for k=1 to 196
print terrain(k);
next k
wait key
end
rem **** Functions ****
rem This is for the one little button. ;)
function button(x,y,maxx,maxy,message$,buttonnum)
if over=0 then ink rgb(155,255,55),0 else ink rgb(55,155,0),0
box x,y+10,maxx,maxy+10
ink rgb(255,155,55),0
box x,y,maxx,maxy
ink rgb(255,255,255),0
center text (x+maxx)/2,(y+maxy)/2,message$
if mousex()>x and mousex()<maxx and mousey()>y and mousey()<maxy+10 and mouseclick()=1
press=buttonnum+1
else
press=0
endif
if mousex()>x and mousex()<maxx and mousey()>y and mousey()<maxy+10
over=1
else
over=0
endif
endfunction press
On the other hand, you have different fingers.