Lua Programming Help Thread
This is a discussion on Lua Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; Code: if timer:time() > 0 < 1000 then x = x - 1 end should be: Code: if timer:time() > ...
-
01-30-2007, 12:02 PM #5431QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
should be:Code:if timer:time() > 0 < 1000 then x = x - 1 end
Code:if timer:time() > 0 and timer:time() < 1000 then x = x - 1 end
[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
01-30-2007, 12:18 PM #5432QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
hmm its still doesnt make that effect -_- never mind and thx
[1 Year QJ Member]
[LUA Coder and C Learner]
[Ball Revamped Clone v0.1]
[Phil's Shooting Range v0.3]
[HideFile PRX v2]
[SSR PRX v1.1]
-
01-30-2007, 12:54 PM #5433QJ Gamer Silver
- Registriert seit
- Oct 2006
- Ort
- 貴方
- Beiträge
- 1.159
- Points
- 7.371
- Level
- 57
- Downloads
- 0
- Uploads
- 0
could someone show me an example of moving an object halfway across the screen from left to right
all your help is much appreciated
thanks
-
01-30-2007, 01:00 PM #5434lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
Like as we control it or it justs moves on its own?
-
01-30-2007, 01:38 PM #5435QJ Gamer Silver
- Registriert seit
- Oct 2006
- Ort
- 貴方
- Beiträge
- 1.159
- Points
- 7.371
- Level
- 57
- Downloads
- 0
- Uploads
- 0
on its own
-
01-30-2007, 03:42 PM #5436QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
um...a simple example is:
Zitat von HeaD ShOt
is it understandable?Code:while true do if object.x < destination.x and object.status == hasnt_reached_destination_yet then object.x = object.x + 1 elseif object.x >= destination.x or object.status ~= hasnt_reached_destination_yet then object.x = object.x - 1 object.status = destination_reached end end
[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
01-30-2007, 03:58 PM #5437
I just started and im only in the ninth grade, but i am looking to become a programer so if figured i my as well start trying, so well that's gone
Zitat von SG57
-
01-30-2007, 04:08 PM #5438QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
lol
Zitat von xtreme0915
ninth grade isnt very special around these parts. there are some amazing youngsters out there...(not me, i wish
)
[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
01-30-2007, 04:08 PM #5439words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
xtreme - Im in 9th gradetoo, so thats no excuse. If I can handle the simple logicallness that is 'a timer' I think you can too...

...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here
-
01-30-2007, 04:09 PM #5440lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
It doesn't matter what grade your in.
-
01-30-2007, 04:11 PM #5441
wow, that hurts, lol, looks like i got some research ahead of me
-
01-30-2007, 04:22 PM #5442Asleep...

- Registriert seit
- Oct 2005
- Beiträge
- 1.383
- Points
- 11.516
- Level
- 70
- Downloads
- 0
- Uploads
- 0
im in 9th grade >_>...
i need help..
how would you be able to check if a file was there, and if it is, return as eighter true or false? (if possible, i think it is)
-
01-30-2007, 04:23 PM #5443QJ Gamer Silver
- Registriert seit
- Oct 2006
- Ort
- 貴方
- Beiträge
- 1.159
- Points
- 7.371
- Level
- 57
- Downloads
- 0
- Uploads
- 0
only...
btw
there is a sample script for this at Evilmana
-
01-30-2007, 04:26 PM #5444Asleep...

- Registriert seit
- Oct 2005
- Beiträge
- 1.383
- Points
- 11.516
- Level
- 70
- Downloads
- 0
- Uploads
- 0
for timers or checking if a file is there?
Zitat von HeaD_ShOt
-
01-30-2007, 04:35 PM #5445QJ Gamer Silver
- Registriert seit
- Oct 2006
- Ort
- 貴方
- Beiträge
- 1.159
- Points
- 7.371
- Level
- 57
- Downloads
- 0
- Uploads
- 0
timers
link
Zitat von codebase at evilmana
-
01-30-2007, 04:36 PM #5446words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
yauster - I know, but I was porting it, and was hoping to gainevery aspect of the PC version. But, seeing theactual mechanics of a particle engine such as this, Im going to write my own. That way, I learn something :)
I have all evening to do it, so hopefully you could look over my code later on for optimization tricks :o Also, Ill be making it visually better, as in using either small textured quads OR simply pixels (ill need alot of particles if i use pixels). (im trying to say i understand the mechanics of atleast one type of particle engine and now i believe ican write my own)...
itll probably look the same as some others in many aspects, but honestly, itll be my own, whether or not you believe me doesnt matter to me too much...
*starts individual particle structure*
-= Double Post =-
Im confused on the question being asked but...
Code:if io.open("file.extension","r") then --file exists else --file doesnt exist endGeändert von SG57 (01-30-2007 um 04:36 PM Uhr) Grund: Automerged Doublepost

...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here
-
01-30-2007, 04:46 PM #5447Asleep...

- Registriert seit
- Oct 2005
- Beiträge
- 1.383
- Points
- 11.516
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Zitat von SG57
yeah thats perfect thanks
-
01-30-2007, 06:19 PM #5448
ok you guys i really want to get this, if i have
how can i make it end after going through once and begin another timer? sorry for so many questions but i am really tryingCode:timer = Timer.new() timer:start() while true do screen:clear() screen:print(208,131,"Checking flash0",red) if timer:time() >= 1000 and timer:time() < 2000 then screen:print(272,131,".",red) elseif timer:time() >= 2000 and timer:time() < 3000 then screen:print(272,131,"..",red) elseif timer:time() >= 3000 and timer:time() < 4000 then screen:print(272,131,"...",red) elseif timer:time() >= 4000 then
-
01-30-2007, 06:38 PM #5449QJ Gamer Blue
- Registriert seit
- Jul 2006
- Beiträge
- 72
- Points
- 4.209
- Level
- 41
- Downloads
- 0
- Uploads
- 0
didn't I post before that rather than starting another timer, you could just use math.floor(timer:time()/1000)=2
I think I did but Im too lazy to check so yeah there ya go. If you really want it to be another timer, then you could use Timer:reset([startTime]) and then restart the timer.
-
01-30-2007, 07:39 PM #5450words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
yauster - I have all the basics sofar, now I just need to set a random x and y coordinate plane speed... I have to do some research on google, but if you get this before i do, please post a way (i have an angle of direction set up, 0-360 as i want it to be in a circle, randomly set each time the particle dies).
xtreme - You arent thinking logically, there fore you lose... If you wantto start another timer when a certain timer reaches a certain time, you do..
Code:timer1 = Timer.new() timer2 = Timer.new() timer1:start() while true do if timer1:time() > 10000 then timer1:stop() timer2:start() end end
...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here
-
01-30-2007, 07:49 PM #5451
oh, haha, thanks, today i have done a little more research and discovered a little more.
http://files.filefront.com//;6652077;;/
what do you think?
**NOTE** when the screen is black you must press a button to begin
-
01-30-2007, 08:40 PM #5452words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
I dont have a PSP, so I cant really do much enjoyable...
Anywho...
Ive finished my particle engine. Im going to debug it now and fix any syntax errors, then ill upload it. Hopefully someone can test it and tellme what they tink...
...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here
-
01-30-2007, 08:41 PM #5453QJ Gamer Silver

- Registriert seit
- Oct 2006
- Ort
- Pimp'en in the US F#
- Beiträge
- 1.254
- Points
- 7.278
- Level
- 56
- Downloads
- 0
- Uploads
- 0
Ill test if you want SG
NEWMy New BLOG!NEWThe Wentire Worls in two Sectors....When did I get dev statz?
Spoiler for my PSP homebrewReleases:Spoiler for Great Quotes:
-
01-30-2007, 08:58 PM #5454words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
Alright guys, i made this particle engine, using prior PD experience, but sure enough, i typed it up and only had to research on one part for 1 minute... In the end, i came up with this... please test it someone and if you can,video tape it as eyece has done ;)
Code:--[[ Lua Particle Demo By: SG57 No more than an eye looker... For now ;) ]] num_particles = 299 -- # of particles to have on screen particle = {} for i=0,num_particles do -- constructs each particle with default values particle[i] = { x=240,y=136, -- x and y coordinates xspeed,yspeed, -- speed on x and y planes color=Color.new(255,255,255), -- color of particle life=0, -- life determines color ^ angle=math.random(360), -- random angle for particle movement speed=10, -- particle speed fade_speed=20, -- fading speed of particle r=255,g=255,b=255 -- so color can be changed } particle[i].xspeed = math.sin(particle[i].angle) * particle[i].speed -- set x axis vector speed particle[i].yspeed = math.cos(particle[i].angle) * particle[i].speed -- set y axis vector speed end while true do screen:clear() for i=0,num_particles do particle[i].xspeed = math.sin(particle[i].angle) * particle[i].speed -- set x axis vector speed particle[i].yspeed = math.cos(particle[i].angle) * particle[i].speed -- set y axis vector speed particle[i].x = particle[i].x + particle[i].xspeed -- Vector speeds particle[i].y = particle[i].y + particle[i].yspeed -- ^ particle[i].color = Color.new(particle[i].r,particle[i].g,particle[i].b,particle[i].life) if particle[i].life >= 255 then particle[i].r=math.random(255) particle[i].g=math.random(255) particle[i].b=math.random(255) particle[i].life = 0 particle[i].speed=math.random(1,3) particle[i].fade_speed=math.random(7,9) particle[i].x = 240 particle[i].y = 136 particle[i].angle=math.random(360) end particle[i].life = particle[i].life + particle[i].fade_speed screen:fillRect(particle[i].x,particle[i].y,2,2,particle[i].color) end screen.waitVblankStart() screen.flip() end
...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here
-
01-30-2007, 09:19 PM #5455lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
It runs pretty smooth on the PSP.
I cant get to a camera but maybe later unless someone else does it.
-
01-30-2007, 09:23 PM #5456words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
Im not to worried about framerate, rather the look of it. Id like to know what you think it looks like... A fire, a bomb, etc.?

...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here
-
01-30-2007, 09:29 PM #5457lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
It looks more like an explosion, Like at the middle you see all the clolors, Then it just spreads out. Its really smooth so it looks really kool on the PSP.
-
01-30-2007, 09:36 PM #5458words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
Wait, so it explodes, the colors spread across screen, then it explodes again? Im aiming for a smooth constant flame type thing - easily fixable. But Im going to port this code to VB 6.0 so i can see it correctly. and modify it appropriatly.
Oh and also - do the explosion particles fade away atall? or just scatter of screen? Id really like a video someone
Cant you get the screen capture module thing shrrom? You just press R+SELECT i believe to take a video fo wahtever is on the screen...

...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here
-
01-30-2007, 09:38 PM #5459lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
Ok, I will downlaod SVC, But it explodes at first like in a circle motion, Then it starts to spread out from the middle, But it doesnt look like they fade away, They just disappear.
-
01-30-2007, 09:43 PM #5460words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
Ahh.. ok. And yes, it should explode ina circle motion, than it should just act as a fire or a smoke type effect... Once you get the video thing uploaded, ll be able to really see what i can do to improve it. Also, make sure you use that trick to compress the GIF and whatnot... That way, its not like 30 mb.

...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here


LinkBack URL
About LinkBacks
Mit Zitat antworten

Hello everyone I am new here and I am glad to be part of this amazing community and I think there...
New to forum