> PSPMOD Youtube Template
> PSP Guides
> PSP Downloads

> PC Talk Forums

> Free PSP Demos



Recommended Sites
-
PSP Downloads
-
PSP News
Free PSP Demos

Forums

-
General Announcements
-Introduce Yourself
-
PSP News
-PVP's Archives
PSP Mod's and Hacks
-
Hardware
-
Firmware
-
PSP Custom Firmware
-
Sony PSP Homebrew
-
PSP General
-
PSP Emulation
-
PSP Wireless
PSP Games
-
PSP Games
-
PSP Game Reviews
-PSP Homebrew Rev
Entertainment
-
Other Consoles
-
Movies/Music On PSP
-
Movie/Music Reviews
-
Digital Art
-
PSP Scams
-PSPMOD Youtube
-PSP Demos
 


Go Back   Sony PSP Mod & PSP Hacks Forums > PSP Mod's and Hack's > Sony PSP Homebrew
User Name
Password

Reply
 
Thread Tools Display Modes
Old anyone know how to code games for psp, i need so help!!!! 10-04-2007, 09:15 PM   #1 (permalink)
linkinworm
Senior Member
I Modded My PSP
 
linkinworm's Avatar
 
Join Date: May 2007
Posts: 209
Firmware Installed: 3.71 m33-3

Default anyone know how to code games for psp, i need so help!!!!

ok so me n a mate want to make a game, but i cant get some code to work, basicaly i wrote a simple menu code and i made it so only start works at the moment but how do i "link" it to the other code which is a charactor shooting,

what are these "table" i read about, do i have to use them between different bit of code so that everything works to gether heres waht i have so far
basicaly i only added the option for the start option to work and added the this is not available in beta screen print on cheats

o just tried to make this thread so iv gota edit some caps locks letters to i have only 10 images or something like that

screen: Print should all be one thing didnt want the face in the code




--Colors
white = Color.new(255,255,255)
red = Color.new(255,0,0)

current = 1 --this is our current menu selection
oldpad = Controls.read()
while true do
pad = Controls.read()
screen:clear()
-- Prints our 5 menu options
screen: print(240,100,"Start",white)
screen: print(240,110,"Options",white)
screen: print(240,120,"High Scores",white)
screen: print(240,130,"Cheats",white)
screen: print(240,140,"Exit",white)
-- These make it so when the variable "current" changes
-- so does the current menu selection
if current == 1 then
screen: print(240,100,"Start",red)
end
if current == 2 then
screen: print(240,110,"Options",red)
end
if current == 3 then
screen: print(240,120,"High Scores",red)
end
if current == 4 then
screen: print(240,130,"Cheats",red)
end
if current == 5 then
screen: print(240,140,"Exit",red)
end
-- Makes it so when UP/DOWN is pressed, the variable
-- "current" changes making the selection change
if pad:up() and oldpad:up() ~= pad:up() then
current = current - 1
end
if pad:down() and oldpad:down() ~= pad:down() then
current = current + 1
end
--Makes it so the selection goes from the bottom to top
if current == 6 then
current = 1
end
if current == 0 then
current = 5
end
screen.waitVblankStart()
screen.flip()
oldpad = pad
end
-- To make the menu work you just need to add a few
-- if/then statements. For example


--if pad:cross() and current == 1 then
--Start()
--end

-- you press Cross then it will do the function Start()

if pad:cross() and current == 1 then
start
end

***SECOND CODE THIS IS THE SHOOTING CHARACTOR*****
***HOW TO I GET IT SO PRESSING START ON THE MENU***
***LAUNCHES THIS CODE BELOW****
****ALSO AN EXIT OPTION WOULD BE HELPFULL****
***AND GIVE ME A GREAT DEAL OF KNOWLEGE TO FURTHER***
***THIS GAME****

--Create colors
green=Color.new(0,255,0)
white = Color.new(255,255,255)

--Create a blank image and fill it with green. This will be our bullet.
bullet = Image.createEmpty(4,4)
bullet:clear(green)

--Create a player.
player = Image.createEmpty(32,32)
player:clear(white)

--Variables
oldpad = Controls.read()
currentBullet = 0
direction = "right"

--Player Array
Player = {}
Player[1] = { x = 30, y = 100 }

--Create Array for Bullets
BulletInfo = {}
for a = 1,5 do
BulletInfo[a] = { pic = bullet , firing = false, direction = "right", x = Player[1].x + 32,
y = Player[1].y + 16 }
end

--Functions

function bulletSetup()
--Increase the current bullet by one, or reset it to 1
if currentBullet < 5 then
currentBullet = currentBullet + 1
else
currentBullet = 1
end

if direction == "left" then
BulletInfo[currentBullet].x = Player[1].x
BulletInfo[currentBullet].y = Player[1].y + 16
end
if direction == "right" then
BulletInfo[currentBullet].x = Player[1].x + 32
BulletInfo[currentBullet].y = Player[1].y + 16
end
if direction == "up" then
BulletInfo[currentBullet].x = Player[1].x + 16
BulletInfo[currentBullet].y = Player[1].y
end
if direction == "down" then
BulletInfo[currentBullet].x = Player[1].x + 16
BulletInfo[currentBullet].y = Player[1].y + 32
end

BulletInfo[currentBullet].direction = direction
BulletInfo[currentBullet].firing = true
end

function bulletFire()
for i = 1,5 do
if BulletInfo[i].firing == true then
if BulletInfo[i].direction == "right" then BulletInfo[i].x = BulletInfo[i].x + 10 end
if BulletInfo[i].direction == "left" then BulletInfo[i].x = BulletInfo[i].x - 10 end
if BulletInfo[i].direction == "up" then BulletInfo[i].y = BulletInfo[i].y - 10 end
if BulletInfo[i].direction == "down" then BulletInfo[i].y = BulletInfo[i].y + 10 end
screen:blit(BulletInfo[i].x,BulletInfo[i].y,BulletInfo[i].pic)
end
if BulletInfo[i].x < 0 or BulletInfo[i].x > 480 or BulletInfo[i].y < 0 or BulletInfo[i].y > 272 then
BulletInfo[i].firing = false
end
end
end

function movePlayer()
pad = Controls.read()
if pad:left() then
Player[1].x = Player[1].x - 1
direction = "left"
end
if pad:right() then
Player[1].x = Player[1].x + 1
direction = "right"
end
if pad:up() then
Player[1].y = Player[1].y - 1
direction = "up"
end
if pad:down() then
Player[1].y = Player[1].y + 1
direction = "down"
end
end

--Main Loop
while true do
pad = Controls.read()
screen:clear()

screen:blit(Player[1].x, Player[1].y, player)

if pad:cross() and oldpad:cross() ~= pad:cross() then
bulletSetup()
end

--Print bullet info to screen.
screen: print(10,10,"Bullet 1: ".. tostring(BulletInfo[1].firing),green)
screen: print(10,20,"Bullet 2: "..tostring(BulletInfo[2].firing),green)
screen: print(10,30,"Bullet 3: "..tostring(BulletInfo[3].firing),green)
screen: print(10,40,"Bullet 4: "..tostring(BulletInfo[4].firing),green)
screen: print(10,50,"Bullet 5: "..tostring(BulletInfo[5].firing),green)
screen: print(10,60,"Direction: "..direction,green)
movePlayer()

bulletFire()

screen.waitVblankStart()
screen.flip()
oldpad = pad
end

Last edited by linkinworm : 10-04-2007 at 09:20 PM.
linkinworm is offline  
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

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

vB 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. The time now is 10:52 AM.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.0.0 RC8