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!

2 lua questions

This is a discussion on 2 lua questions within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; my first lua question is my background pic covers up all my other pics how do i make it to ...

Reply
 
LinkBack Thread Tools
Old 10-21-2005, 06:44 PM   #1

Developer
 
slicer4ever's Avatar
 
Join Date: Jul 2005
Location: everywhere
Posts: 3,357
Trader Feedback: 0
Talking 2 lua questions

my first lua question is my background pic covers up all my other pics how do i make it to not cover anyother pics

2nd: i have an image that i start out with but wanna change it when i press a button so how do i make it so it makes a new picture at the same location?

i will upload my current code at your request
__________________
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
slicer4ever is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-21-2005, 06:45 PM   #2

6201ymereJ
 
Join Date: Jul 2005
Location: Baltimore
Posts: 588
Trader Feedback: 0
Default

put up the code hombre...
Jeremy1026 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-21-2005, 06:59 PM   #3

Developer
 
slicer4ever's Avatar
 
Join Date: Jul 2005
Location: everywhere
Posts: 3,357
Trader Feedback: 0
Talking

k 1 sec

p.s. it still is only in lua

Quote:
System.usbDiskModeActivat e()

green=Color.new(0,255,0)
orange=Color.new(255,128, 0)
teal=Color.new(64,128,128 )
blue=Color.new(0,0,255)
red=Color.new(255,0,0)
black=Color.new(0,0,0)
lightgreen=Color.new(0,25 5,128)
lightyellow=Color.new(255 ,255,128)

redballX=200
redballY=150
redballColor=blue

background = Image.load("pic/background.png")
redball = Image.load("pic/redball.png")
redballblue = Image.load("pic/redballblue.png")
redballred = Image.load("pic/redballred.png")
redballorange = Image.load("pic/redballorange.png")
redballgreen = Image.load("pic/redballgreen.png")
redballteal = Image.load("pic/redballteal.png")
redballblack = Image.load("pic/redballblack.png")
redballlightgreen = Image.load("pic/redballlightgreen.png")
redballlightyellow = Image.load("pic/redballlightyellow.png")

while true do
screen:clear()
pad=Controls.read()
if pad:cross() then screen:blit(redballX, redballY, redball)
elseif pad:triangle() then screen:blit(redballX, redballY, redballblue)
elseif pad:circle() then screen:blit(redballX, redballY, redballlightyellow)
elseif pad:square() then screen:blit(redballX, redballY, redballorange)
elseif pad:start() then screen:blit(redballX, redballY, redballgreen)
elseif pad:l() then screen:blit(redballX, redballY, redballteal)
elseif pad:r() then screen:blit(redballX, redballY, redballlightgreen)
elseif pad:select() then break
end

if pad:up() then redballY=redballY-5
elseif pad:down() then redballY=redballY+5
elseif pad:left() then redballX=redballX-5
elseif pad:right() then redballX=redballX+5
end

screen:blit(redballX, redballY, redball)
screen.waitVblankStart()
screen.flip()
end
p.s. the colors are only for future reference
__________________
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
slicer4ever is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-21-2005, 07:03 PM   #4

6201ymereJ
 
Join Date: Jul 2005
Location: Baltimore
Posts: 588
Trader Feedback: 0
Default

it looks like u need to clear the screen before u reblit the new image...but, im no genius, there is someone that should know more than me...but thats my assesment of #2, as for number one, i dont even see ur background image code in there. besides when u call it for future reference
Jeremy1026 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-21-2005, 07:05 PM   #5

Developer
 
Join Date: Jun 2005
Location: At my house...
Posts: 885
Trader Feedback: 0
Default

ok if u want ur background to be in the "background then blit it to the screen before the rest of the images
__________________
F.A.L.O?
Twenty 2 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-21-2005, 07:11 PM   #6

Developer
 
slicer4ever's Avatar
 
Join Date: Jul 2005
Location: everywhere
Posts: 3,357
Trader Feedback: 0
Talking

i had the code in there earlier but i forgot to put it back in berfore i posted it anyways is there a way to just make the background without an actuall pic i read it somewhere but now i cant find it
__________________
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
slicer4ever is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-21-2005, 07:21 PM   #7
 
XteticX's Avatar
 
Join Date: Jun 2005
Location: script.lua
Posts: 426
Trader Feedback: 0
Default

Hey, I just posted soemthing similar for you , but just in case you dotn see it, I'll post again. :icon_wink You have too many blits in there. You should just create a new variable, something like "CurrentBall" and have your script blit its value only once. That way, when you press a button, you only have to change the value of "CurrentBall".... like CurrentBall=redball whatever. Simpler that way.
XteticX is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-21-2005, 07:23 PM   #8
 
XteticX's Avatar
 
Join Date: Jun 2005
Location: script.lua
Posts: 426
Trader Feedback: 0
Default

Quote:
Originally Posted by slicer4ever
i had the code in there earlier but i forgot to put it back in berfore i posted it anyways is there a way to just make the background without an actuall pic i read it somewhere but now i cant find it
If its only a one color background then just draw a rectangle across the screen.

Code:
screen:fillRect(0,0,480,272,color)
Sorry for double post.
XteticX is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-21-2005, 07:45 PM   #9

Developer
 
slicer4ever's Avatar
 
Join Date: Jul 2005
Location: everywhere
Posts: 3,357
Trader Feedback: 0
Talking

Quote:
Originally Posted by XteticX
Hey, I just posted soemthing similar for you , but just in case you dotn see it, I'll post again. :icon_wink You have too many blits in there. You should just create a new variable, something like "CurrentBall" and have your script blit its value only once. That way, when you press a button, you only have to change the value of "CurrentBall".... like CurrentBall=redball whatever. Simpler that way.
wait i dont understand where am i surpose to put this code i would like to implement it so where would it go
__________________
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
slicer4ever is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-21-2005, 08:09 PM   #10
 
XteticX's Avatar
 
Join Date: Jun 2005
Location: script.lua
Posts: 426
Trader Feedback: 0
Default

Code:
 System.usbDiskModeActivat e()

green=Color.new(0,255,0)
orange=Color.new(255,128, 0)
teal=Color.new(64,128,128 )
blue=Color.new(0,0,255)
red=Color.new(255,0,0)
black=Color.new(0,0,0)
lightgreen=Color.new(0,25 5,128)
lightyellow=Color.new(255 ,255,128)

redballX=200
redballY=150
redballColor=blue

background = Image.load("pic/background.png")
redball = Image.load("pic/redball.png")
redballblue = Image.load("pic/redballblue.png")
redballred = Image.load("pic/redballred.png")
redballorange = Image.load("pic/redballorange.png")
redballgreen = Image.load("pic/redballgreen.png")
redballteal = Image.load("pic/redballteal.png")
redballblack = Image.load("pic/redballblack.png")
redballlightgreen = Image.load("pic/redballlightgreen.png")
redballlightyellow = Image.load("pic/redballlightyellow.png")

--initiate dafault value
CurrentBall=redballred

while true do
screen:clear()
pad=Controls.read()
   if pad:cross() then CurrentBall=redballred
   elseif pad:triangle() then CurrentBall=redballblue
   elseif pad:circle() then CurrentBall=redballlightyellow
   elseif pad:square() then CurrentBall=redballorange
   elseif pad:start() then CurrentBall=redballgreen
   elseif pad:l() then CurrentBall=redballteal
   elseif pad:r() then CurrentBall=redballlightgreen
   elseif pad:select() then break
   end

   if pad:up() then redballY=redballY-5
   elseif pad:down() then redballY=redballY+5
   elseif pad:left() then redballX=redballX-5
   elseif pad:right() then redballX=redballX+5
   end


--You only blit it once, but you can change its value by pressing buttons 
   screen:blit(redballX, redballY, CurrentBall)
   screen.waitVblankStart()
   screen.flip()
end
XteticX is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-21-2005, 08:17 PM   #11

Developer
 
slicer4ever's Avatar
 
Join Date: Jul 2005
Location: everywhere
Posts: 3,357
Trader Feedback: 0
Talking

o, ok i see thanks you guys are very helpful
__________________
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
slicer4ever is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-21-2005, 08:40 PM   #12

Developer
 
slicer4ever's Avatar
 
Join Date: Jul 2005
Location: everywhere
Posts: 3,357
Trader Feedback: 0
Talking

i wrote that code into mine to make sure it works before i implimate it to my own liking but i keep getting a error:

error:= expected near e

u no the rest anyways i have beeen looking though the code but i cant seem to figure out what the error means so could yea help i'm ganna go back though but help would be appreciated.

nvm i think i got it
__________________
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects

Last edited by slicer4ever; 10-21-2005 at 08:43 PM..
slicer4ever is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-21-2005, 08:43 PM   #13
 
Join Date: Oct 2005
Location: Phoenix
Posts: 208
Trader Feedback: 0
Default

In the post with the code, it inserts spaces. For example when it says USBDiskActivat e() it should be USBDiskActivate(), with no spaces.
__________________
[url=http://profile.mygamercard.net/b0xx0r][img]http://card.mygamercard.net/gelsig/b0xx0r.png[/img][/url]
b0xx0r is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-21-2005, 09:26 PM   #14
 
sumpaintballer41's Avatar
 
Join Date: Jul 2005
Location: Ware, MA
Posts: 868
Trader Feedback: 0
Default

ANy particular reason for activating the USB drive??
__________________
Cover your eyes and run...
gmansixfo= STEPMANIA LEGEND!!
Halo2 Gamertag~PSPH4X0R

7/17/06
~The Day My PSP Almost Died~
Thank you
GrandTheftAutoJunkie
sumpaintballer41 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-21-2005, 09:29 PM   #15

Developer
 
Join Date: Jun 2005
Location: At my house...
Posts: 885
Trader Feedback: 0
Default

Read his post it was an example...
__________________
F.A.L.O?
Twenty 2 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-21-2005, 09:52 PM   #16
 
sumpaintballer41's Avatar
 
Join Date: Jul 2005
Location: Ware, MA
Posts: 868
Trader Feedback: 0
Default

Oh just checkin sorry!
__________________
Cover your eyes and run...
gmansixfo= STEPMANIA LEGEND!!
Halo2 Gamertag~PSPH4X0R

7/17/06
~The Day My PSP Almost Died~
Thank you
GrandTheftAutoJunkie
sumpaintballer41 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
lua , questions

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 12:37 PM.



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