QJ.NET | Videos | Forums | iPhone | MMORPG | Nintendo DS | Wii | PlayStation 3 | PSP | Xbox 360 | PC | Downloads | Contact Us
Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact

QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides

Go Back   QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides > Developers Corner > PSP Development, Hacks, and Homebrew > PSP Development Forum
The above video goes away if you are a member and logged in, so log in now!

I Need a Little Help

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 = ...

Reply
 
LinkBack Thread Tools
Old 09-21-2005, 03:37 PM   #1
 
EstaCompton's Avatar
 
Join Date: Jun 2005
Location: EstaCompton, OR
Posts: 62
Trader Feedback: 0
Default I Need a Little Help

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
That's it... opinions? (Incase you haven't read my latest post).
Here's the pix so you can try it yourself
EstaCompton is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-21-2005, 03:54 PM   #2

total-Z
 
youresam's Avatar
 
Join Date: Jul 2005
Location: texas
Posts: 2,803
Trader Feedback: 0
Default

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()
youresam is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-21-2005, 05:11 PM   #3
 
EstaCompton's Avatar
 
Join Date: Jun 2005
Location: EstaCompton, OR
Posts: 62
Trader Feedback: 0
Default

youresam thanx for the tip, I still am getting an error. I'll keep looking through my code to find this error.
NOTE: I tried adding an extra end and, of course, it didn't work.
EstaCompton is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-21-2005, 05:19 PM   #4
I think I ripped my pants
 
whitehawk's Avatar
 
Join Date: Jul 2005
Real First Name: Matt
Location: Toronto
Just Played: Trials HD
Posts: 6,485
Trader Feedback: 0
Default

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
whitehawk is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-21-2005, 05:53 PM   #5
 
EstaCompton's Avatar
 
Join Date: Jun 2005
Location: EstaCompton, OR
Posts: 62
Trader Feedback: 0
Default

whitehawk I'm just a few steps away from this being completed, please - you've helped the most so far!!!
EstaCompton is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-21-2005, 06:26 PM   #6
I think I ripped my pants
 
whitehawk's Avatar
 
Join Date: Jul 2005
Real First Name: Matt
Location: Toronto
Just Played: Trials HD
Posts: 6,485
Trader Feedback: 0
Default

Quote:
Originally Posted by EstaCompton
whitehawk I'm just a few steps away from this being completed, please - you've helped the most so far!!!
Ok. I'll help more What's the problem your having now?
EDIT:Nvm, didn't see your edit. Lemme look at it.
whitehawk is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-21-2005, 06:32 PM   #7
 
EstaCompton's Avatar
 
Join Date: Jun 2005
Location: EstaCompton, OR
Posts: 62
Trader Feedback: 0
Default

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:
EstaCompton is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -8. The time now is 08:02 AM.



Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © 2009, QJ.NET. All Rights Reserved.
Contact Us