yea exactly what i mean, but i mean like how would u have it to make it each object on the map have diffrent properties
Printable View
yea exactly what i mean, but i mean like how would u have it to make it each object on the map have diffrent properties
Well I aint sure on this but I guess something like this would work
Code:System.usbDiskModeActivate()
tiles = Image.load("tiles.png")
map = {
"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm",
"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm",
"mmeaaaaaaaaaaaaaaaaaaaaaaaafmm",
"mmdpnnnnnnnnnnnnnnnnnnnnnnpbmm",
"mmdokcccccclnkccccccccccclnbmm",
"mmdojaaaaafdnbmmmmmmmmmmmdnbmm",
"mmdooooooobdnbmmmmmmmmmmmdnbmm",
"mmdokccclobdnbmmmmmmmmmmmdnbmm",
"mmdobmmmdobdnbmmmmmmmmmmmdnbmm",
"mmdobmmmdobdnjaaaaaaaaaafdnbmm",
"mmdobmmmdpbdnnnnnnnnnnnnbdnbmm",
"mmdobmmmhcghcccccccccclnbdnbmm",
"mmdojaaaaaaaaaaaaaaaaainjinbmm",
"mmdpnnnnnnnnnnnnnnnnnnnnnnpbmm",
"mmhccccccccccccccccccccccccgmm",
"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm",
"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm"
}
function drawTile(tile, x, y)
local tileX = math.mod(tile, 4)
local tileY = math.floor(tile / 4)
screen:blit(16 * x, 16 * y, tiles, 17 * tileX + 1, 17 * tileY + 1, 16, 16, false)
end
while true do
pad = Controls.read()
if pad:start() then break end
screen:clear()
for y = 1, 17 do
line = map[y]
for x = 1, 30 do
tile = string.byte(line, x) - string.byte("a")
drawTile(tile, x - 1, y - 1)
end
end
screen.waitVblankStart()
screen:flip()
end
can someone give me a hand hereZitat:
Zitat von monster356
this was my post from before(in the quote...DUH)
Try using something like this within your main loop:Zitat:
Zitat von monster356
if math.random(1,300) == 150 then
addEnemy(math.random(100, 400))
replace the math.random values with your own to define how frequently enemies will appear, replace the 100,400 values with your own x,y values to give the area spread your enemy will appear in, and define your enemy image as "Enemy".... I think... dont hold me to that. :)
hey it's monster356, i got banned, for like no reason....no one pmed me with a warning, and no one told me i was going to get banned......
so, the addEnemy is a blit?
hey all,
i've finally decided on a game to make with lua, but am quite new to it. I understand basic programming (mostly in BASIC and Fortran, a little C++, from engineering school), but not so much for gaming programs. The game is relatively simple, but there are a few hurdles I need to overcome to make it happen.
Anyway.... the game I have in mind is known as "SameGame" for PC or "Macigame" for MAC as well as many other versions/clones. Essentially, the game is a grid of tiles that when 2 or more tiles touch they can be selected and removed from the grid, whereupon the grid then "collapses" depending on what is removed. Clearing the grid fully and/or highscore is the object of the game.
Some of my initial problems include: (again, I am new to game or graphics-based programming so I don't even know how problematic they may be)
1. Creating a known-sized grid built from randomly selected tiles. i.e. I can build a pre-arranged grid from a tileset(similar to the pacman style gameboards) but am unsure how to make it randomly generated.
2. Use of a cursor to select blocks of touching tiles, where when the cursor is placed over a suitable group this group would become highlighted, or selectable to be removed.
Any help or pointing me in the right direction is greatly appreciated.
Thanks...
hey I'm kinda a newbie at this but here's my question. I'm making a fighter and I made it so that the character can move to each side of the screen and not go past but I want to make it so that the image changes so that it faces the direction it's going. can someone help me?
if facing==1 thenZitat:
Zitat von Ace Hih
screen:blit(X,Y,Pic facing left)
end
if facing==2 then
screen:blit(X,Y,pic facing right)
end
if pad:left() then
facing = 1
imagex = imagex - 3
end
if pad:right() then
facing = 2
imagex = imagex +3
end
Thank you so much. This thread is great!
I hate to be annoying but for some reason it won't work.It worked before I added the code with the comments. here's my code:
System.usbDiskModeActivat e ()
field = Image.load("Naruto forestc.PNG")
block3 = Image.load("player.PNG")
player = Image.load(player2.PNG")
blockposX = 152
blockposY = 195
while true do
screen:blit(0, 0, field)
screen:blit(blockposX, blockposY, block3)
if blockposX <= 2 then
blockposX = 1
end
if blockposX >= 447 then
blockposX = 448
end
if facing==1 then --------This section
screen:blit(blockposX, blockposY, player)
end
if facing==2 then --------This section
screen:blit(blockposX, blockposY, block3)
end
pad = Controls.read()
if pad:left() then
facing = 1 ---------This Line
blockposX = blockposX - 5
end
if pad:right() then
facing = 2 ---------This Line
blockposX = blockposX + 5
end
screen.waitVblankStart()
screen.flip()
if pad:start() then
break
end
end
What did I do wrong?
Oh yeah and I ripped part of the code from someones example on this page for learning purposes. So props to them