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!

New Project - DJ Pong

This is a discussion on New Project - DJ Pong within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; You guessed it, I'm attempting to code a pong game for use with DJSP/PSP Advance. :dance: But now I need ...

Reply
 
LinkBack Thread Tools
Old 09-22-2005, 04:32 PM   #1
 
EstaCompton's Avatar
 
Join Date: Jun 2005
Location: EstaCompton, OR
Posts: 62
Trader Feedback: 0
Default New Project - DJ Pong

You guessed it, I'm attempting to code a pong game for use with DJSP/PSP Advance. :dance: But now I need a tad bit of help. I'm pretty good at Lua now, but this is obviously differnt :think:. Anyway, I coded this pong game using different pong code from two or three different games. Well, when I put this on DJSP/PSP Advance it shows the score... and that's it , but it plays the game by itself. So, if you guy's could help solve that :Pray: I give you super mad props!!! One other thing... when I add the enable/disabledjspcontrols() thing (you know what I mean), I can't return to DJSP/PSP Advance - but when I take it away I can't play the game. Well here's the code, thanx in advance to everyone who helps:

Code:
disableDJSPControls()

--VAR
p1paddle = 0
p2paddle = 0
ballx = 232
bally = 128
dx = 2
dy = 2
top = 0
bottom = 272
right = 480
left = 0
p1score = 0
p2score = 0

--COLOR
white = rgb(255, 255, 255)

--LOAD IMAGES
background = loadImage("data/images/table.png")
paddle = loadImage("data/images/paddle.png")
ball = loadImage("data/images/ball.png")

--GAME
function startgame()

	ballx = 232
	bally = 128
	starty = math.random(0,1)
	startx = math.random(0,1)
	if startx == 0
	then
		dx = -2
	else
		dx = 2
	end

	if starty == 0
	then
		dy = -2
	else
		dy = 2
	end
end

while true do
	pad = readControls(true)
	ballcenterx = ballx + 8
	ballcentery = bally + 8
	balltop = bally
	ballbottom = bally + 16
	ballleft = ballx
	ballright = ballx + 16

	ballx = ballx + dx
	bally = bally + dy
	if balltop <= top
	then
		dy = dy * -1
		bally = bally + 5
	end
	if ballbottom >= bottom
	then
		dy = dy * -1
		bally = bally - 5
	end
	if ballleft <= 0
	then
		p2score = p2score + 1
		startgame()
	end
	if ballright >= 480
	then
		p1score = p1score + 1
		startgame()
	end
	if ltriggerPressed() then
		startGame()
	end
	if trianglePressed()
	then
		p2paddle = p2paddle - 2
		if p2paddle <= 0
		then
			p2paddle = 0
		end
	end
	if crossPressed()
	then
		p2paddle = p2paddle + 2
		if p2paddle >= 210
		then
			p2paddle = 210
		end
	end
	if upPressed()
	then
		p1paddle = p1paddle - 2
		if p1paddle <= 0
		then
			p1paddle = 0
		end
	end
	if downPressed()
	then
		p1paddle = p1paddle + 2
		if p1paddle >= 210
		then
			p1paddle = 210
		end
	end
	if ballleft <= 44 and ballleft >= 42 and ballcentery >= p1paddle and ballcentery <= p1paddle + 62
	then
		dx = dx * -1
		ballx = ballx + 5
	end
	if ballright >= 428 and ballright <=430 and ballcentery >= p2paddle and ballcentery <= p2paddle + 62
	then
		dx = dx * -1
		ballx = ballx - 5
	end
	-- flip screen
	drawImage(ball, ballx, bally)
	drawImage(paddle, 30, p1paddle)
	drawImage(paddle, 428, p2paddle)
	drawImage(background, 0, 0)
	drawText("Player 1: " .. p1score, 10, 10, white, 0)
	drawText("Player 2: " .. p2score, 375, 10, white, 0)
--	waitForVSync()
--	flipScreen()
end

enableDJSPControls()
EstaCompton is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-22-2005, 04:36 PM   #2
 
EstaCompton's Avatar
 
Join Date: Jun 2005
Location: EstaCompton, OR
Posts: 62
Trader Feedback: 0
Default

Please Delete
EstaCompton is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
pong , project

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 02:14 AM.



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