Okay, I'm still working on a simple tower defense of my own, and this is how it's going. However, if you notice, it keeps repeating the first for...next loop. How would I fix that: I do not know what's going on.
`Tower Defense Demo
`Quirkyjim for DarkNOOBS
`Setup
sync on:sync rate 60
lasers = 0
`Get Backdrop
load bitmap "Map.bmp",0
`backdrop on
`color backdrop 0
`get image 1,0,0,640,480
`texture backdrop 1
`Make the Tower
ink rgb(100,100,100),0
box 300,220,340,260
ink rgb(255,0,0),0
box 315,235,325,245
`Make the Enemy's Array
dim path(640,480)
path(1,1)=1
path(2,2)=2
`Make the Enemy
ink rgb(255,0,0),0
box 0,0,50,50
`Make another enemy
`ink rgb(0,255,0),0
`box 100,100,130,130
`Main Loop
x=320:y=240
for enemy = 1 to 153
nx = enemy+46 :ny = enemy+46
ink rgb(100,100,100),0
box 300,220,340,260
ink rgb(255,0,0),0
box 315,235,325,245
ink rgb(255,0,0),0
box 53, enemy, 97, ny
`ink rgb(0,255,0),0
`box 100,100,130,130
`Tests distance
dist = sqrt(((nx-x)exp(2))((nx-y)exp(2)))
if dist < sqrt((130-x)(130-y))
goto lasefirst
else
goto lasesecond
endif
`Checks if a laser is being used
lasefirst:
if lasers = 0
ink rgb(0,255,0),0
line x,y,enemy,ny
lasers = 1
goto syncup
else
lasers = 0
goto syncup
endif
lasesecond:
if lasers = 0
ink rgb(0,255,0),0
line x,y,130,130
lasers = 1
goto syncup
else
lasers = 0
goto syncup
endif
syncup:
sync:cls
load bitmap "Map.bmp",0
print enemy;" First"
next enemy
for enemy = 53 to 253
nx = enemy+46 :ny = enemy+46
ink rgb(100,100,100),0
box 300,220,340,260
ink rgb(255,0,0),0
box 315,235,325,245
ink rgb(255,0,0),0
box enemy, 153, nx, 153+46
`ink rgb(0,255,0),0
`box 100,100,130,130
`Tests distance
dist = sqrt(((nx-x)exp(2))((nx-y)exp(2)))
if dist < sqrt((130-x)(130-y))
goto lasefirst
else
goto lasesecond
endif
`Checks if a laser is being used
lasefirst1:
if lasers = 0
ink rgb(0,255,0),0
line x,y,enemy,ny
lasers = 1
goto syncup
else
lasers = 0
goto syncup
endif
lasesecond2:
if lasers = 0
ink rgb(0,255,0),0
line x,y,130,130
lasers = 1
goto syncup
else
lasers = 0
goto syncup
endif
syncup1:
sync:cls
load bitmap "Map.bmp",0
print enemy;" Second"
next enemy
cls
print "Laser Demo"
wait key
end
P.S. I do know that the laser doesn't work, I'm working on the path currently
P.P.S. There is media with it, I'm attaching it.
@Irojo
Kool tetris so far, but I'd like to say a few things.
1)The controls are a little bit extreme, it's such high sensitivity that it's hard to specifically plant the block.
2)Get workin on those blocks!
~QJ