All pastes #1229528 Raw Edit

tron for BEX

public text v1 · immutable
#1229528 ·published 2008-10-17 17:39 UTC
rendered paste body
restart:
	bgcolor 4,1
	print "Tron"
	print "Edited by Eric from:"
	print "SHNAKEEE!"
	print "by devster"
	print "p2 press start"
	while joypad(1).7=0
		sleep 1
	wend
	randomize timer
	cls
	
	length=5
	dir=1
	delay=8
	dim positionx(50) as integer
	dim positiony(50) as integer
	for a=0 to length
		positionx(a)=5+a
		positiony(a)=10
	next
	drawtile &h01,positionx(0),positiony(0)

	length2=5
	dir2=3
	delay2=8
	dim positionx2(50) as integer
	dim positiony2(50) as integer
	for a2=0 to length2
		positionx2(a2)=35+a2
		positiony2(a2)=10
	next
	
	while 1
		drawtile 0,positionx(length),positiony(length)
		for a=length to 0 step -1
			positionx(a+1)=positionx(a)
			positiony(a+1)=positiony(a)
		next
		drawtile &hDB,positionx(0),positiony(0)
		if dir=0 then
			if positiony(0)=0 then goto gameover
			positiony(0)=positiony(0)-1
		elseif dir=1 then
			if positionx(0)=39 then goto gameover
			positionx(0)=positionx(0)+1
		elseif dir=2 then
			if positiony(0)=27 then goto gameover
			positiony(0)=positiony(0)+1
		elseif dir=3 then
			if positionx(0)=0 then goto gameover
			positionx(0)=positionx(0)-1
		endif
		length=length+1
		a=readtile(positionx(0),positiony(0))
		if a=&hDB then
			goto gameover
		endif
		drawtile &h01,positionx(0),positiony(0)
		key=0
		for a=0 to delay
			if key=0 then key=joypad()
			sleep 1
		next
		if key.0 then dir=0
		if key.2 then dir=3
		if key.1 then dir=2
		if key.3 then dir=1

		drawtile 0,positionx2(length2),positiony2(length2)
		for a2=length2 to 0 step -1
			positionx2(a2+1)=positionx2(a2)
			positiony2(a2+1)=positiony2(a2)
		next
		drawtile &hDB,positionx2(0),positiony2(0)
		if dir2=0 then
			if positiony2(0)=0 then goto gameover2
			positiony2(0)=positiony2(0)-1
		elseif dir2=1 then
			if positionx2(0)=39 then goto gameover2
			positionx2(0)=positionx2(0)+1
		elseif dir2=2 then
			if positiony2(0)=27 then goto gameover2
			positiony2(0)=positiony2(0)+1
		elseif dir2=3 then
			if positionx2(0)=0 then goto gameover2
			positionx2(0)=positionx2(0)-1
		endif
		length2=length2+1
		a2=readtile(positionx2(0),positiony2(0))
		if a2=&hDB then
			goto gameover2
		endif
		drawtile &h01,positionx2(0),positiony2(0)
		key2=0
		for a2=0 to delay2
			if key2=0 then key2=joypad(1)
			sleep 1
		next
		if key2.0 then dir2=0
		if key2.2 then dir2=3
		if key2.1 then dir2=2
		if key2.3 then dir2=1
	wend

gameover:
	pallette &h000A,3,1
	locate 0,0
	print "GAME OVER! p2 wins"
	print "p2 press start to restart"
	while 1
	if joypad(1).7 = 1 then goto restart
	wend
	
gameover2:
	pallette &h000A,3,1
	locate 0,0
	print "GAME OVER! p1 wins"
	print "p2 press start to restart"
	while 1
	if joypad(1).7 = 1 then goto restart
	wend