PSP3D Left Header
PSP3D Header Right
PSP3D Logo CraveOnline Logo
Help the PSP 3D community grow!
Vote for us below:


Vote on the PSP Top 200
PSP Top 200 - Games, Videos, Wallpapers, Files, Hacks, Homebrew

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!

Go Back PSP3D.com - Sony PlayStation Portable News, Homebrew, Hacks, Reviews, Videos, Mods, Forums > PSP Forums > Development Center
Tags: luaprogramming [X]


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-23-2007, 08:50 PM
Merick's Avatar
Merick Merick is offline
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.
Reply With Quote
  #2 (permalink)  
Old 02-23-2007, 10:38 PM
jsf's Avatar
jsf jsf is offline
Joint Strike Fighter
 
Join Date: Dec 2005
Location: Lancaster Pennsylvania USA
Age: 20
Posts: 2,147
Points: 100,000,000,000.08
Donate
Send a message via AIM to jsf Send a message via MSN to jsf

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
Reply With Quote
  #3 (permalink)  
Old 02-24-2007, 12:38 AM
Merick's Avatar
Merick Merick is offline
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.
Reply With Quote
  #4 (permalink)  
Old 02-24-2007, 01:16 AM
Merick's Avatar
Merick Merick is offline
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.
Reply With Quote
  #5 (permalink)  
Old 02-24-2007, 03:23 AM
Merick's Avatar
Merick Merick is offline
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?
Reply With Quote
  #6 (permalink)  
Old 02-24-2007, 07:01 AM
sikheadtom's Avatar
sikheadtom sikheadtom is offline
Is Da Best PSP3D Member
My Mood:
 
Join Date: Dec 2005
Location: England
Posts: 651
Points: 1.06
Donate
Send a message via AIM to sikheadtom Send a message via MSN to sikheadtom
I can't remember much Lua but would it be

PHP Code:
if scrollmode == 1 then scrollforward() end 
__________________
SNES, PS1, PS2, PSP and PS3
Number of times reached 1000 posts: 3
Reply With Quote
  #7 (permalink)  
Old 02-24-2007, 01:27 PM
Merick's Avatar
Merick Merick is offline
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
Reply With Quote
  #8 (permalink)  
Old 02-24-2007, 06:17 PM
Merick's Avatar
Merick Merick is offline
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.
Reply With Quote
  #9 (permalink)  
Old 02-24-2007, 07:06 PM
sikheadtom's Avatar
sikheadtom sikheadtom is offline
Is Da Best PSP3D Member
My Mood:
 
Join Date: Dec 2005
Location: England
Posts: 651
Points: 1.06
Donate
Send a message via AIM to sikheadtom Send a message via MSN to sikheadtom
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!
Attached Files
File Type: rar scroll engine.rar (989.8 KB, 6 views)
__________________
SNES, PS1, PS2, PSP and PS3
Number of times reached 1000 posts: 3

Last edited by sikheadtom : 02-24-2007 at 07:20 PM.
Reply With Quote
  #10 (permalink)  
Old 02-24-2007, 08:13 PM
Merick's Avatar
Merick Merick is offline
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)
Reply With Quote
Reply

« My 1st LUA | graphics editing for lua »



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 On
Trackbacks are On
Pingbacks are On
Refbacks are On

Points Per Thread View: 0.00
Points Per Thread: 1.00
Points Per Reply: 0.10

Similar Threads
Thread Thread Starter Forum Replies Last Post
[TUTORIAL] LUA: The Begginer Lesson rikardo_92 Getting Started/Help/Tutorials 16 09-17-2006 09:22 AM
Lua Y's Released! Robert A. Homepage News 2 07-21-2006 02:47 PM
LUA Player v0.20 Released! Robert A. Homepage News 5 06-05-2006 07:52 PM
The Big Fucking Lua Thread!!!!!!!!!! badg0r Development Center 49 04-06-2006 11:44 AM
Interesting bug found in Lua Player Demo V0.16 badg0r General PSP Discussion 2 03-11-2006 03:48 PM





Crave Partner Sites: CraveOnline.com | DVDFile.com | PSP3D.com | ComingSoon.net | SuperHeroHype.com | RedBalcony.com | ActionTrip.com | CraveLyrics.com
Soundtrack.net | CraveFix.com | SpikedHumor.com | RPGamer.com | TattooNow.com | ImpactWrestling.com | SeekLyrics.com | PedalBMX.com | WildKO.com
vidKing.com | StrategyInformer.com | HHdb.com | RapLeagues.com | HipHop-Lyrics.com | Cravecocktails.com | ThePhatPhree.com | RideJudge.com | HottieSpots.com

PSP3D Footer Left Powered by Custom vB Version 5.1.0 for Crave Online Media, LLC.
Copyright © 2000 - 2007, Jelsoft Enterprises Ltd. and PSP3D.com.
LinkBacks Enabled by vBSEO 3.0.0 RC8

All times are GMT -4. The time now is 09:11 AM.
PSP3D Footer Right