alright ive kinda found how to make verticall and horizontal lines now, but i still want to make a outline 272X272 but i can only make 2 of the sides the left and top heres my code
so how am i gonna go about adding other lines everywhere else in the code for the maze?
since using the code thing distores the code here it is
]--Jay Lock
--11/7/06
--Copyright, All code must be credited if used elsewhere
--Dugeon Crawler
--Colors
blue=Color.new(0,0,255)
green=Color.new(0,255,0)
--Player Color
player = Image.createEmpty(10,10)
player:clear(blue)
--Block Color
blockV = Image.createEmpty(5,15)
blockV:clear(green)
blockH = Image.createEmpty(15,5)
blockH:clear(green)
--Player Placement and Size
Player = { x = 5, y = 5 }
playerHeight = 10
playerWidth = 10
--Block Placement and Size
Block = {}
blockY = 0
blockX= 0
for a = 1,20 do
Block[a] = { x = 0, y = blockY, height = blockV:height(), width = blockV:width() }
blockY = blockY + 15
end
for b = 21,40 do
Block[b] = { x = blockX, y = 0, height = blockH:height(), width = blockH:width() }
blockX = blockX + 15
end
--movePlayer Function
function movePlayer()
pad = Controls.read()
if pad:left() then
Player.x = Player.x - 2
end
if pad:right() then
Player.x = Player.x + 2
end
if pad:up() then
Player.y = Player.y - 2
end
if pad:down() then
Player.y = Player.y + 2
end
end
--Collision Check Function
function collisionCheck(object)
if (Player.x + playerWidth > object.x)
and
(Player.x < object.x + object.width)
and
(Player.y + playerHeight > object.y)
and
(Player.y < object.y + object.height) then
Player.x = oldx
Player.y = oldy
end
end
--Gameloop
while true do
oldx = Player.x
oldy = Player.y
screen:clear()
movePlayer()
--check collision for each block
for a= 1,20 do
collisionCheck(Block[a])
end
for b= 21,40 do
collisionCheck(Block[b])
end
--paste player to screen
screen:blit(Player.x,Player.y,player)
--paste all blocks to screen
for a = 1,20 do
screen:blit(Block[a].x,Block[a].y,blockV)
end
for b = 21,40 do
screen:blit(Block[b].x,Block[b].y,blockH)
end
if Controls.read():start() then
screen:clear()
break
end
screen.waitVblankStart()
screen.flip()
end
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks