![]() |
| Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact |
| ||||||
This is a discussion on I Need a Little Help within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; Here it is so far... Code: --USB System.usbDiskModeActivate() --VAR score1p = 0 score2p = 0 ballx = 233 bally = ...
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 |
![]() |
Here it is so far...
Code:
--USB
System.usbDiskModeActivate()
--VAR
score1p = 0
score2p = 0
ballx = 233
bally = 130
ballvecx = -1
ballvecy = 1
pad1px = 2
pad1py = 100
pad2px = 462
pad2py = 100
vel = 2
--COLORZ
white = Color.new(255, 255, 255)
green = Color.new(0, 255, 0)
red = Color.new(255, 0, 0)
blue = Color.new(0, 0, 255)
grey = Color.new(10, 10, 10)
--LOAD IMAGES
Table = Image.load("data/images/table.png")
Paddle = Image.load("data/images/paddle.png")
Ball = Image.load("data/images/ball.png")
--GAME
while true do
pad = Controls.read()
if pad:start() then
break
end
if pad:down() then
if pad1py < 272 - Paddle:height() then
pad1py = pad1py + 5
if pad:l() then
pad1py = pad1py +2
end
else
pad1py = 271 - Paddle:height()
end
end
if pad:up() then
if pad1py > 0 then
pad1py = pad1py - 5
if pad:l() then
pad1py = pad1py - 2
end
else
pad1py = 1
end
end
if pad:cross() then
if pad2py < 272 - Paddle:height() then
pad2py = pad2py + 5
if pad:r() then
pad2py = pad2py + 2
end
else
pad2py = 271 - Paddle:height()
end
end
if pad:triangle() then
if pad2py > 0 then
pad2py = pad2py - 5
if pad:r() then
pad2py = pad2py - 2
end
else
pad2py = 1
end
end
if ballx < 0 then
score2p = score2p + 1
ballx = 233
bally = 130
vel = 2
end
if ballx > 480 then
score1p = score1p + 1
ballx = 233
bally = 130
vel = 2
end
if (bally < 2) or (bally > 271 - Ball:height()) then
ballvecy = -ballvecy
end
if (ballx < pad1px + Paddle:width()) and (bally > pad1py) and (bally < pad1py + Paddle:height()) then
ballvecx = -ballvecx
ballx = pad1px + Paddle:width() + 1
vel= vel + .2
end
if (ballx > pad2px - Ball:width()) and (bally > pad2py) and (bally < pad2py + Paddle:height()) then
ballvecx = -ballvecx
ballx = pad2px - Ball:width() - 1
vel= vel + .2
ballx = ballx + ballvecx*vel
bally = bally + ballvecy*vel
end
screen:blit(0, 0, Table, 0, 0, Table:width(), Table:height(), false)
screen:blit(ballx, bally, Ball, 0, 0, Ball:width(), Ball:height(), true)
screen:blit(pad1px, pad1py, Paddle, 0, 0, Paddle:width(), Paddle:height(), true)
screen:blit(pad2px, pad2py, Paddle, 0, 0, Paddle:width(), Paddle:height(), true)
screen:print(218,10, score1p, white)
screen:print(253,10, score2p, white)
screen.flip()
end
Here's the pix so you can try it yourself |
|
|
|
|
|
#2 |
![]() ![]() total-Z
|
dude, I looked over your code, you have 'end' for no reason:
Code:
ballx = ballx + ballvecx*vel bally = bally + ballvecy*vel screen:blit(ballx, bally, Ball, 0, 0, Ball:width(), Ball:height(), true) end screen.flip() screen.waitVblankStart() |
|
|
|
|
|
#4 | |
![]() I think I ripped my pants
Join Date: Jul 2005
Real First Name: Matt
Location: Toronto
Just Played: Trials HD
Posts: 6,485
Trader Feedback: 0
|
Try this
Code:
ballx = ballx + ballvecx*vel bally = bally + ballvecy*vel while true do screen:blit(ballx, bally, Ball, 0, 0, Ball:width(), Ball:height(), true) screen.flip() end
__________________
![]() |
|
|
|
|
|
|
#6 | ||
![]() I think I ripped my pants
Join Date: Jul 2005
Real First Name: Matt
Location: Toronto
Just Played: Trials HD
Posts: 6,485
Trader Feedback: 0
|
Quote:
What's the problem your having now?EDIT:Nvm, didn't see your edit. Lemme look at it.
__________________
![]() |
||
|
|
|
|
|
#7 |
![]() |
whitehawk, forget all that crap... i'm updating it now, i got the paddles to show up and function as well as the score, background - but the ball won't move. Wait a sec let me fix my code...
p.s.: thank you mr. lua GOD!!! :Pray: |
|
|
|
![]() |
| Thread Tools | |
|
|