![]() |
| Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact |
| ||||||
This is a discussion on RELEASE: umm....minigame? (need help) within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; ok ok so it's not a release . but i wuz workin on sumthin and it's kinda a variation between ...
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 |
![]() ![]() Tha Sigerator
|
ok ok so it's not a release. but i wuz workin on sumthin and it's kinda a variation between falldown and a maze. i've started the coding but i'm not sure how to finish it
any lua coders out thur help will be GREATLY appreciated...ok so lemme get it started.The Basic Concept of the game is to get ur white dot to the left of the screen....if u get to the left. u win.....if you touch the right....u lose SIMPLE. SOOOO i got the coding started (collisions with walls, collision with blocks, and the first 2 sets moving) but i need sum one to help out with geting the blocks to repeat...i can't think of a code that would make the 1st set of blocks keep goin while starting a new set...(i wuz thinkin about taking advantage of the OS timer but idk how. like i said HELP! lookin for parter lol. Anywayz i'll go out on a limb and post my code (and the script.lua so u can see how it actually runs(so far)) i think once all the blocks r coming it would be damn hard! but umm yea. here's the stuff (script uploaded ALL the way at bottom) screenshots: ![]() code: Code:
green=Color.new(0,255,0)
white = Color.new(255,255,255)
player = Image.createEmpty(10,10)
player:clear(white)
block = Image.createEmpty(480,4)
block:clear(green)
block2 = Image.createEmpty(4,272)
block2:clear(green)
block3 = Image.createEmpty(20,20)
block3:clear(green)
block4 = Image.createEmpty(20,20)
block4:clear(green)
block5 = Image.createEmpty(20,20)
block5:clear(green)
block6 = Image.createEmpty(20,20)
block6:clear(green)
Player = { x = 460, y = 100 }
playerHeight = 10
playerWidth = 10
Block = {}
Block[1] = { x = 0, y = 0, height = block:height(), width = block:width() }
Block[2] = { x = 0, y = 268, height = block:height(), width = block:width() }
Block2 = {}
Block2[1] = { x = 0, y = 0, height = block2:height(), width = block2:width() }
Block2[2] = { x = 476, y = 0, height = block2:height(), width = block2:width() }
--
bling = true
lala = 1
lala2 = -35
lala3 = -70
lala4 = -105
Block3 = {}
Block3[1] = { x = lala, y = 34, height = block3:height(), width = block3:width() }
Block3[2] = { x = lala, y = 68, height = block3:height(), width = block3:width() }
Block3[3] = { x = lala, y = 102, height = block3:height(), width = block3:width() }
Block3[4] = { x = lala, y = 136, height = block3:height(), width = block3:width() }
Block3[5] = { x = lala, y = 170, height = block3:height(), width = block3:width() }
Block3[6] = { x = lala, y = 204, height = block3:height(), width = block3:width() }
Block3[7] = { x = lala, y = 238, height = block3:height(), width = block3:width() }
Block3[8] = { x = lala, y = 272, height = block3:height(), width = block3:width() }
Block4 = {}
Block4[1] = { x = lala2, y = 17, height = block4:height(), width = block4:width() }
Block4[2] = { x = lala2, y = 51, height = block4:height(), width = block4:width() }
Block4[3] = { x = lala2, y = 85, height = block4:height(), width = block4:width() }
Block4[4] = { x = lala2, y = 119, height = block4:height(), width = block4:width() }
Block4[5] = { x = lala2, y = 153, height = block4:height(), width = block4:width() }
Block4[6] = { x = lala2, y = 187, height = block4:height(), width = block4:width() }
Block4[7] = { x = lala2, y = 221, height = block4:height(), width = block4:width() }
Block4[8] = { x = lala2, y = 255, height = block4:height(), width = block4:width() }
Block5 = {}
Block5[1] = { x = lala3, y = 34, height = block3:height(), width = block5:width() }
Block5[2] = { x = lala3, y = 68, height = block3:height(), width = block5:width() }
Block5[3] = { x = lala3, y = 102, height = block3:height(), width = block5:width() }
Block5[4] = { x = lala3, y = 136, height = block3:height(), width = block5:width() }
Block5[5] = { x = lala3, y = 170, height = block3:height(), width = block5:width() }
Block5[6] = { x = lala3, y = 204, height = block3:height(), width = block5:width() }
Block5[7] = { x = lala3, y = 238, height = block3:height(), width = block5:width() }
Block5[8] = { x = lala3, y = 272, height = block3:height(), width = block5:width() }
Block6 = {}
Block6[1] = { x = lala4, y = 17, height = block4:height(), width = block4:width() }
Block6[2] = { x = lala4, y = 51, height = block4:height(), width = block4:width() }
Block6[3] = { x = lala4, y = 85, height = block4:height(), width = block4:width() }
Block6[4] = { x = lala4, y = 119, height = block4:height(), width = block4:width() }
Block6[5] = { x = lala4, y = 153, height = block4:height(), width = block4:width() }
Block6[6] = { x = lala4, y = 187, height = block4:height(), width = block4:width() }
Block6[7] = { x = lala4, y = 221, height = block4:height(), width = block4:width() }
Block6[8] = { x = lala4, y = 255, height = block4:height(), width = block4:width() }
--
function movePlayer()
pad = Controls.read()
if pad:left() then
Player.x = Player.x - 3
end
if pad:right() then
Player.x = Player.x + 3
end
if pad:up() then
Player.y = Player.y - 3
end
if pad:down() then
Player.y = Player.y + 3
end
end
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
while true do
-- store player's position at beginning of each loop
if bling == true then
oldx = Player.x + 1.3
end
oldy = Player.y
screen:clear()
movePlayer()
--check collision for each block
collisionCheck(Block[1])
collisionCheck(Block[2])
collisionCheck(Block2[1])
collisionCheck(Block2[2])
collisionCheck(Block3[1])
collisionCheck(Block3[2])
collisionCheck(Block3[3])
collisionCheck(Block3[4])
collisionCheck(Block3[5])
collisionCheck(Block3[6])
collisionCheck(Block3[7])
collisionCheck(Block3[8])
collisionCheck(Block4[1])
collisionCheck(Block4[2])
collisionCheck(Block4[3])
collisionCheck(Block4[4])
collisionCheck(Block4[5])
collisionCheck(Block4[6])
collisionCheck(Block4[7])
collisionCheck(Block4[8])
collisionCheck(Block5[1])
collisionCheck(Block5[2])
collisionCheck(Block5[3])
collisionCheck(Block5[4])
collisionCheck(Block5[5])
collisionCheck(Block5[6])
collisionCheck(Block5[7])
collisionCheck(Block5[8])
collisionCheck(Block6[1])
collisionCheck(Block6[2])
collisionCheck(Block6[3])
collisionCheck(Block6[4])
collisionCheck(Block6[5])
collisionCheck(Block6[6])
collisionCheck(Block6[7])
collisionCheck(Block6[8])
--paste player to screen
screen:blit(Player.x,Player.y,player)
--paste blocks to screen
for a = 1,2 do
screen:blit(Block[a].x,Block[a].y,block)
screen:blit(Block2[a].x,Block2[a].y,block2)
end
for b = 1,8 do
screen:blit(Block3[b].x,Block3[b].y,block3)
screen:blit(Block4[b].x,Block4[b].y,block4)
end
for c = 1,8 do
screen:blit(Block5[c].x,Block5[c].y,block5)
screen:blit(Block6[c].x,Block6[c].y,block6)
end
-- 1st block movement
for c = 1,8 do
if bling == true then
Block3[c].x = Block3[c].x + 1
end
end
-- 2nd block movement
for c = 1,8 do
if bling == true then
Block4[c].x = Block4[c].x + 1
end
end
-- 3rd block movement
for c = 1,8 do
if bling == true then
Block5[c].x = Block5[c].x + 1
end
end
-- 4thd block movement
for c = 1,8 do
if bling == true then
Block6[c].x = Block6[c].x + 1
end
end
screen.waitVblankStart()
screen.flip()
end
__________________
- - - - Somewhere Lurking in THA SHADOWS - - - -
Last edited by Xodiac21; 05-26-2006 at 09:43 PM.. |
|
|
|
|
|
#3 |
![]() ![]() Developer
|
I'd suggest you look into arrays more, and 'for' loops.
You are repeating a lot of things over and over again (creating images, checking collisions etc) which are unnessercary. Once you have the code in the correct format, you'll easily be able to add what you require. |
|
|
|
|
|
#4 | |
![]() ![]() Tha Sigerator
|
Quote:
i like to get it rnning near perfect b4 i clean up
__________________
- - - - Somewhere Lurking in THA SHADOWS - - - -
|
|
|
|
|
|
|
#6 |
![]() ![]() Developer
|
A: i agree with the posts above me look into arrays and loops really helpful and yes what do you mean by getting the blocks to repeat?
__________________
1. Failed....again... 2. http://slicer.gibbocool.com/ stay updated on all my projects |
|
|
|
|
|
#7 |
![]() ![]() Developer
|
I believe he means a new 'column' of blocks to generate when required.
As I stated, if the game is setup to generate a new column based on a timer or whatever and everything is tracked in arrays, it should be easily doable. |
|
|
|
|
|
#8 |
![]() ![]() Tha Sigerator
|
ok. i kind said i wanted to do iw withe the OS time thing... but i didn't know the commands. AND if i did do it that way, when it repeted would the first set of blocks keep going or just reset?
edit: did u run the game in lua player(windows or psp). once u do it SHOULD be simple to see what i'm goin for
__________________
- - - - Somewhere Lurking in THA SHADOWS - - - -
Last edited by Xodiac21; 05-27-2006 at 12:30 PM.. |
|
|
|
|
|
#9 |
![]() ![]() Tha Sigerator
|
OK i THINK i got away to do it...(probly not the best but it SHOUD work)
ok so i was gonna make 2 block "fields" that span 480 pixels wide (the width of screen). now i can go about making them repeat 2 diff ways. put them side by side (the x var. would be negative) and when they scroop make and if then statement that says if "first block field.x" = either 0 or 480 (it diepends on what single block i use) then (change variables of FIRST "block field") back to original...then do the same for the 2nd block field (so it's contious/looping.... OR i can time how ong it takes the first block field to reach the edge and then do the same if then statement but chang it to time or whaever.... if anyone could think of a better/easier way to do this plz don't hesitate to post it
__________________
- - - - Somewhere Lurking in THA SHADOWS - - - -
|
|
|
|
|
|
#11 | |
![]() ![]() Tha Sigerator
|
Quote:
but umm. picture the game falldown. u know how the blocks keep coming UP at u as u try to reach the bottom, THATs what tis game is jus horizontally. my code is incomplete. when the blocks come it wont be in a small burst like it shows in the pics (and game lol) it's goonna be tightly packed together. (i jus answered ur question, if u were talkin bout the blocks reverse and scrool back to the left) but essentally i want the blocks (one full 480 wide field) to scroll all the way to the end then when they get there reset back to the original x and go again (while another field is coming so it looks non stop) got it?
__________________
- - - - Somewhere Lurking in THA SHADOWS - - - -
|
|
|
|
|
![]() |
| Tags |
| release , ummminigame |
| Thread Tools | |
|
|