Help the PSP 3D community grow! Vote for us below:


| | Development Center - Learn the basics of coding or talk about advanced coding techniques with other developers. |
Welcome to PSP3D.com - Sony PlayStation Portable News, Homebrew, Hacks, Reviews, Videos, Mods, Forums!
You are currently viewing our website as a guest, which gives you limited access to reply and interact to discussions and other members. By joining our free community, you will be able to post topics in the forums, communicate privately with other members, vote in polls, and access many other special features.
Registration is fast, simple, and absolutely free so join our community today!
| 
02-23-2007, 08:50 PM
| | Member
My Mood: | | Join Date: Feb 2007
Posts: 45
Points: 73.56 Donate | | | LUA Paralax scrolling It's been over 10 years since I've tried to do any programming, and even then I only dabbled a little with quickbasic. But after figuring out how to play hombrew on my psp I decided to play around with with lua and see if I could come up with something.
This zip has my first program, it's an experiment for a scrolling paralax background.
Last edited by Merick : 02-24-2007 at 10:33 PM.
| 
02-23-2007, 10:38 PM
| | Joint Strike Fighter | | Join Date: Dec 2005 Location: Lancaster Pennsylvania USA Age: 20
Posts: 2,147
Points: 100,000,000,000.08 Donate | | | Cool i'll try it out.
Doubleposted Message Below:
I just tried it. it's pretty cool. Keep up the good work. i'm looking forward to seeing what you come up with in the future
Last edited by jsf : 02-23-2007 at 10:38 PM.
Reason: PSP3D.com Doublepost Preventer
| 
02-24-2007, 12:38 AM
| | Member
My Mood: | | Join Date: Feb 2007
Posts: 45
Points: 73.56 Donate | | | new stuff added -
d-pad moves the ship
holding down cross slowly increases scroll speed, releasing it will slowly decrease scroll speed
tapping circle will increase ship movement speed
tapping triangle will decrease ship speed
*edit*
small change, just updated the ship graphic to one with transparency
Last edited by Merick : 02-24-2007 at 10:33 PM.
| 
02-24-2007, 01:16 AM
| | Member
My Mood: | | Join Date: Feb 2007
Posts: 45
Points: 73.56 Donate | | and now I've fixed a couple of error in the code that would let the ship move out of the viewing area. I've also added background music from gradius 3 (not made by me, but found at The Mod Archive - Modarchive V2.0)
Except for the middle layer graphic (which I made myself), mostl other graphics that I will be using are from various free image sites that don't require you to give credit.
This zip just has the music file and an updated program file
Last edited by Merick : 02-24-2007 at 10:33 PM.
| 
02-24-2007, 03:23 AM
| | Member
My Mood: | | Join Date: Feb 2007
Posts: 45
Points: 73.56 Donate | | | ack, something's wrong
I removed the scroll from the main program and set it up as a function called scrollforward. I then set up a variable called scrollmode and set it to 1.
In the main body of the prog, if I use this:
if scrollmode = 1 then scrollforward() end
i get the debug message:
error: paralax.lua:76: 'then' expected near '='
however, if i change it to:
if scrollmode then scrollforward() end
it works??
I'm planning to more scroll functions - forward, reverse, up, and down. So I need to be able to tell what number (1-4) that scrollmode is set to. Any ideas? | 
02-24-2007, 07:01 AM
| | Is Da Best PSP3D Member
My Mood: | | Join Date: Dec 2005 Location: England
Posts: 651
Points: 1.06 Donate | | I can't remember much Lua but would it be PHP Code: if scrollmode == 1 then scrollforward() end
| 
02-24-2007, 01:27 PM
| | Member
My Mood: | | Join Date: Feb 2007
Posts: 45
Points: 73.56 Donate | | | yeah, you're right that was the problem, thanks!
Doubleposted Message Below:
Is there a size limit for images that can be loaded with Image.load?
Doubleposted Message Below:
nvm found it - 512x512
Last edited by Merick : 02-24-2007 at 01:27 PM.
Reason: PSP3D.com Doublepost Preventer
| 
02-24-2007, 06:17 PM
| | Member
My Mood: | | Join Date: Feb 2007
Posts: 45
Points: 73.56 Donate | | | .
New version, I'm gonna need help debugging it though. I've changed the code so that all layers use a 512x512 tile, with the middle and front layers using transparencies.I've commented out the drawing of the middle and front layers in this version.
I've got it set up so that the images for the layers are displayed three times:
x - 512, x, x + 512 for horizontal scroll
y - 512, y, y + 512 for vertical scroll
for each mode, the opposite coord is set to zero
However, it's not working out quite like it should. In horizontal mode, I get a black bar that appears on the left side of the screen when the scroll cycle reaches a certain point. The same thing happens at the top of the screen in vertical mode, except that the black bar takes up almost have the screen.
control change for this version:
analog stick: move ship
d-pad: change scroll mode
*note - the board wouldn't let me upload the file as a zip, so I changed the extension to .mp3 to get past the size restriction. Just change it back to .zip to extract the files.
Last edited by Merick : 02-24-2007 at 10:33 PM.
| 
02-24-2007, 07:06 PM
| | Is Da Best PSP3D Member
My Mood: | | Join Date: Dec 2005 Location: England
Posts: 651
Points: 1.06 Donate | | Gonna try now
EDIT: Use WinRAR to make it a .rar,
Looking at the source, it's great for someone who has only just learnt Lua!
Last edited by sikheadtom : 02-24-2007 at 07:20 PM.
| 
02-24-2007, 08:13 PM
| | Member
My Mood: | | Join Date: Feb 2007
Posts: 45
Points: 73.56 Donate | | | well, years ago I did do a lot of messing around with quickbasic. Never really got past doing simple graphics with it though (kaleidescope etc..), didn't have the patience back then to learn how to do things like sprites and stuff. Although I was a little confused by the differences at first, lua is turning out to be much easier to program (graphics wise at least, I won't be getting into collisions and stuff until I get the main display engine worked out) | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is On Points Per Thread View: 0.00 Points Per Thread: 1.00 Points Per Reply: 0.10 | | | | |