Zeige Ergebnis 2.761 bis 2.790 von 10238
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; can u post the code for replacing the yellow pixels with purple?...
-
07-07-2006, 01:39 PM #2761is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
can u post the code for replacing the yellow pixels with purple?
What did we think the world would look like in 2015?
http://forums.qj.net/501501-post26.html
Zitat von Abe
-
07-07-2006, 02:32 PM #2762Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
heres my theory: i havent tried it yet.
Zitat von Glynnder- PSPro
first, blit the image. THEN define purple, and yellow, and some vars:
thenCode:yellow = Color.new(255, 255, 0) purple = Color.new(102, 0, 153) a = 0 b = 0
if the image is 480X272)
probably wont work. but its worth a try.Code:while a < 481 and b < 273 do color = image.pixel(a,b) colors = color:colors() if (color == yellow) then assert(colors.r == 102) assert(colors.g == 0) assert(colors.b == 153) a = a+1 else a = a+1 end if a > 480 then a = 0 b = b+1 end end
--------------------------------------------------------------------------------------
-
07-09-2006, 09:55 AM #2763QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
jw...
is there a way to break back to the xmb screen? i'm planning to make it a standalone app but i have an exit in there and i was wondering if there was a way to break back to the xmb screen?
edit: if i dl lua source do i need to re-compile it afterwards?Geändert von slicer4ever (07-09-2006 um 10:06 AM Uhr)
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
07-09-2006, 10:05 AM #2764I'm Baaaack!

- Registriert seit
- May 2006
- Ort
- Nowhere
- Beiträge
- 2.186
- Points
- 17.067
- Level
- 83
- Downloads
- 0
- Uploads
- 0
I asked this question a while back on a different forum. I never got an answer though.
Zitat von slicer4ever
Also, does anybody know how to make gravity? Like if a player jumps, it comes back down.
-
07-09-2006, 10:13 AM #2765QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
kinda easy for example if you look at the source of my game(block attack you well see how i did gravity)
but heres an example:
that should work as to simulate sometype of gravityCode:cyan = Color.new(0,255,255) block = Image.createEmpty(20,20) block:clear(cyan) gravity = 1 upmove = 5 block_Array = {} block_Array[1] = {x = 240, y = 250} function check_for_jump() block_array[1].y = block_Array[1].y + gravity if block_array[1].y > 250 then block_array[1].y = 250 end if pad:cross() then block_Array[1].y = block_Array[1].y - upmove end end while true do screen:blit(block_array[1].x,block_array[1].y,block) check_for_jump() screen.flip() screen.waitVblankStart() end1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
07-09-2006, 10:16 AM #2766I'm Baaaack!

- Registriert seit
- May 2006
- Ort
- Nowhere
- Beiträge
- 2.186
- Points
- 17.067
- Level
- 83
- Downloads
- 0
- Uploads
- 0
Thanks, now that I really took a look at it, it's really easy.
Zitat von slicer4ever

-
07-09-2006, 12:53 PM #2767QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
well since my other question hasen't been answered i ask a new one:
how do you draw a circle?
i've tried:
screen:drawcirc
screen:fillCirc
thats about it1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
07-09-2006, 01:13 PM #2768QJ Gamer Green
- Registriert seit
- Sep 2005
- Ort
- Texas
- Beiträge
- 146
- Points
- 5.981
- Level
- 50
- Downloads
- 0
- Uploads
- 0
From the lua code snippets thread :
Zitat von slicer4ever
Plenty of other good snippets in there too.Code:function drawCirc(where, x, y, radius, color) theta = 0 while theta<=360 do where:drawLine((math.sin( theta)*radius)+x, (math.cos(theta)*radius)+ y, (math.sin(theta+1)*radius )+x, (math.cos(theta+1)*radius )+y, color) theta = theta+1 end end
[IMG]http://img.photobucket.com/albums/v693/fchaos/koolaidsig.jpg[/IMG]
-
07-09-2006, 01:19 PM #2769QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
o well i went to luaplayer.org and looked at ther functions thing ut couldn't find anything there well thanks=-)
edit: what am i surpose to put at the where?Geändert von slicer4ever (07-09-2006 um 01:32 PM Uhr)
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
07-09-2006, 01:39 PM #2770I'm Baaaack!

- Registriert seit
- May 2006
- Ort
- Nowhere
- Beiträge
- 2.186
- Points
- 17.067
- Level
- 83
- Downloads
- 0
- Uploads
- 0
How do you use animated sprites in lua?

-
07-09-2006, 01:41 PM #2771QJ Gamer Silver
- Registriert seit
- Jun 2005
- Ort
- The Migrant Fleet
- Beiträge
- 908
- Points
- 9.678
- Level
- 66
- Downloads
- 0
- Uploads
- 0
Make a timer and for time 1-20 do one animation, 21-40 another animation, etc..
-
07-09-2006, 01:43 PM #2772I'm Baaaack!

- Registriert seit
- May 2006
- Ort
- Nowhere
- Beiträge
- 2.186
- Points
- 17.067
- Level
- 83
- Downloads
- 0
- Uploads
- 0
I thought of that, but I thought there would be an easier way.

-
07-11-2006, 05:36 PM #2773
ok i was wondering if someone could help me with this: so ok i have 2 blocks of the exact same size in which i want to touch and when they do i want them to change to another 2ndary picture i have for them so basicly i want a collision in which they touch a both change pictures because i can't figure it out so yeah thanks in advance
-
07-11-2006, 07:47 PM #2774Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
search "collisions in lua" and follow hat guide.
Zitat von pspsalv2
--------------------------------------------------------------------------------------
-
07-13-2006, 10:11 AM #2775
i need help with making an object/picture move left and right because i what i seem to be doing is getting it to go only right and stop and not go back left so help[ would be much appreciated.
-
07-13-2006, 10:18 AM #2776
Can you post your code? Then its easier to help you. Or atleast the part which involves the moving of the character.
LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
07-13-2006, 11:56 AM #2777QJ Gamer Green
- Registriert seit
- Oct 2005
- Ort
- Scotland, UK
- Beiträge
- 571
- Points
- 7.057
- Level
- 55
- Downloads
- 0
- Uploads
- 0
hey is there a way to get a character to move and change image while moving. What i mean by this is like when your using a sprite sheet.
Edit: i do actually know how to let the player move just not change images while doing soGeändert von mark.sparky (07-13-2006 um 11:59 AM Uhr)
-
07-13-2006, 12:00 PM #2778Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
The word you're looking for is 'animation'
Zitat von mark.sparky

Check out my homebrew & C tutorials at http://insomniac.0x89.org/
Coder formerly known as Insomniac197
tshirtz: what is irshell ??
Atarian_: it's where people who work for the IRS go when they die
-
07-13-2006, 12:05 PM #2779QJ Gamer Green
- Registriert seit
- Oct 2005
- Ort
- Scotland, UK
- Beiträge
- 571
- Points
- 7.057
- Level
- 55
- Downloads
- 0
- Uploads
- 0
yes so do you know how to do it?
-
07-13-2006, 01:13 PM #2780Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
It's been too long since I used Lua to be of any assistance really.
What I would do though is download some of the hundreds of Lua homebrew games that are available and look at their animation code - it's the best way to learn.
Check out my homebrew & C tutorials at http://insomniac.0x89.org/
Coder formerly known as Insomniac197
tshirtz: what is irshell ??
Atarian_: it's where people who work for the IRS go when they die
-
07-13-2006, 01:26 PM #2781QJ Gamer Green
- Registriert seit
- Oct 2005
- Ort
- Scotland, UK
- Beiträge
- 571
- Points
- 7.057
- Level
- 55
- Downloads
- 0
- Uploads
- 0
thnx anyway even if you are no help
-
07-13-2006, 01:28 PM #2782sceKernelExitGame();
- Registriert seit
- Jan 2006
- Ort
- New York
- Beiträge
- 3.126
- Points
- 19.955
- Level
- 89
- Downloads
- 0
- Uploads
- 0
I remember seeing on the pspdev.org forums a example of animation. I believe is what on page 3, 4 or 5 of the lua section for psp. I'll try looking later if you are too lazy ;).
-
07-13-2006, 02:18 PM #2783QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Dark_Alex Command Center
- Beiträge
- 597
- Points
- 5.866
- Level
- 49
- Downloads
- 0
- Uploads
- 0
has anyone got TTLDE1.0 or 2.0 working with new Luaplayer20?? i used them fine on 0.16 but i keep getting a no script found in Luaplayer20...
[FONT=Fixedsys][spoiler="PSP DAX_Hacks"]PSP1001 3.71-M33-4 ------------------------------------------
- 17 Diff Castlevania Games on 4Gb Stick Cps2psp2.30 - MVSpsp[/FONT][FONT=Fixedsys]2.30[/FONT][FONT=Fixedsys] + Bootlegs - gpSP09 - PsUltraRip - Manhunt2 Uncensored
[/spoiler] [/FONT][FONT=Fixedsys]Consoles Pwnd: PSP, Xbox360
Pwnd: PSP, PSOne, PS2, Xbox360
[/FONT]
-
07-13-2006, 02:50 PM #2784QJ Gamer Green
- Registriert seit
- Oct 2005
- Ort
- Illinois
- Beiträge
- 897
- Points
- 8.215
- Level
- 61
- Downloads
- 0
- Uploads
- 0
http://www.sendspace.com/file/4jg6xl
Can someone take a look at my load. There is a problem with putting the animation on the screen.
-
07-13-2006, 04:59 PM #2785
okay i tried this:Can you post your code? Then its easier to help you. Or atleast the part which involves the moving of the character.
Today 11:11 AM
if x>= 0 and x < 450 then x = x + 2
end
if x == 450 and x>0 then x = x-2
end
but that just makes it stop at the right side forever so yeah please help
-
07-13-2006, 05:56 PM #2786I'm Baaaack!

- Registriert seit
- May 2006
- Ort
- Nowhere
- Beiträge
- 2.186
- Points
- 17.067
- Level
- 83
- Downloads
- 0
- Uploads
- 0
I think I may have had this problem before, try this:
Zitat von pspsalv2
Hope this helps.Code:if x >= 0 and x <= 250 then x=x+2 end if x <= 450 and x >= 0 then x = x - 2 end
EDIT- I just noticed why you get stuck on the right side. You put
if x == 450
that means that if x = 449 then it won't move left. Just change that to <=.Geändert von Access_Denied (07-13-2006 um 06:08 PM Uhr)

-
07-13-2006, 06:11 PM #2787words 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
pspsalv2 - Thats because its doing what you told it to. I was kinda bored and had about 5-10 minutes so i made a visual :) You have a loop going on but you dont know it.

Oh and as how to fix it, use a bool.
Your code still wont work as it applys to the above paradox. Plus, it doesnt matter if he says if it is == 450 as he is improving by 2's, so it WILL hit the 450 mark, then go down, then go back up for being less then 450.
Zitat von Access_Denied
Geändert von SG57 (07-13-2006 um 06:17 PM Uhr)

...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
-
07-13-2006, 06:19 PM #2788
I think I may have had this problem before, try this:
Code:
if x >= 0 and x <= 250 then
x=x+2
end
if x <= 450 and x >= 0 then
x = x - 2
end
Hope this helps.
EDIT- I just noticed why you get stuck on the right side. You put
if x == 450
that means that if x = 449 then it won't move left. Just change that to <=.
thanks but access denied ....
yeah im not too sure what that is SG57 so if you or someone else could explain...pleaseOh and as how to fix it, use a bool.
-
07-13-2006, 06:29 PM #2789Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Zitat von pspsalv2
a bool is basically a true or false statement. try this:
hiow i helpedCode:move_right = false move_left = false while true do if if x >= 0 and x <= 250 then move_right = true move_left = false end if x <= 450 and x >= 0 then move_right = false move_left = true end if move_right == true then x = x+2 end if move_left == true then x = x-2 end end
Geändert von Grimfate126 (07-13-2006 um 06:35 PM Uhr)
--------------------------------------------------------------------------------------
-
07-13-2006, 06:30 PM #2790
Ok im assuming you understand SG57's explanation of why it moves to the right and then stops at 450.
About the boolean thing: a boolean is a variable that can either be "true" or "false".
So lets say you have a variable called "moveleft". While you move to the right, its false. When you are at 450 you set it to true. So you say:
if x == 450 then
moveleft=true
end
Then when its true you say:
if moveleft==true then
x=x-2
end
EDIT: Damn you Grimfate, grrrr!LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]


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