Zeige Ergebnis 6.391 bis 6.420 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; yeah, I stuck at typing:Argh:...
-
03-26-2007, 04:34 PM #6391Developer

- Registriert seit
- Oct 2006
- Ort
- San Diego
- Beiträge
- 177
- Points
- 4.205
- Level
- 41
- Downloads
- 0
- Uploads
- 0
yeah, I stuck at typing:Argh:
-
03-26-2007, 04:51 PM #6392
Ohhh makes sense. Thanks.
That method isn't exactly what I was looking to do...I want it to run independant to the other events that are still moving/displaying things.Geändert von ClearTranquil (03-26-2007 um 05:04 PM Uhr)
-
03-26-2007, 05:17 PM #6393
create a state - player_hit, and a counter. When the player gets hit, set the state to true. Then set all your player actions inside an if statement. If player_hit == false then you run the normal player controls and stuff. If player hit == true then you block the normal player stuff, and add 1 to the counter variable. when the counter reaches a certain number, you do the + 25 to the position and set the counter to 0, when you've done the + 25 3 times, you set player_hit to false in addition to reseting the counter
-
03-26-2007, 05:24 PM #6394
It seems everytime I try and create a "count = count +1" it does it infinately high right from the start. As if "count = count + 1000000000" wouldn't make it any different.
-
03-26-2007, 05:36 PM #6395
how are you doing it?
here's a simple counter, it adds 1 the the count each program cycle then displays the count:
Code:white = Color.new(255,255,255) count = 0 while true do count = count +1 screen:clear() screen:print(10,10,count, white) screen:flip() pad = Controls.read() if pad:cross() then break end if pad:square() then count =0 end end
-
03-26-2007, 05:59 PM #6396
That explains alot for me. I was putting count within an if statement. (noob)
-
03-26-2007, 06:36 PM #6397
well actually, you do want the count inside an if statement, I.E. if player hit == true then count = count + 1, and then inside that same if statement do if count = (60/3) then +25 to player pos and have another statement - if count >= 60 then count = 0 , player_hit = false
-
03-26-2007, 10:35 PM #6398
haha, well, this is the lua help thread, and i need lua help.
I want to use a "player" move kind've script but implement it into an image that kind've slides up and down when i press pad up and pad down, i've been going through some ideas and i've had some luck. However, i cannot seem to stop the image at pixels 0 and 512 (in other words, stop the picture from rolling off screen whilst holding up or down. I've had some some luck, but whenever it seems to work i get errors like "loop ungettable".
Any help would be appreciated.
-
03-26-2007, 10:59 PM #6399words 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
Code:if pad:up() and player.y > 0 then player.y = player.y - someSpeed end if pad:down() and player.y+player.height < 512 then player.y = player.y + someSpeed 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
-
03-27-2007, 09:37 AM #6400
I'm sure this my codes aren't efficient at all but I'm having some problems with collision. I'm thinking of just redoing it and making each map a separate file because this is just starting to get long and ridiculous.
Basically my problems are:
-When multiple buttons are pressed against a wall it gets REALLY screwed and the character flies in diagonal directions
-When the monster pushes the character against the wall she still goes right through it.
-When you push the monster back into some walls it applies both the X and Y displacement for some reason.
It's really frustrating...I can understand how to do collision based on objects but what I need is outer walls. The code I posted is for this map:

What I wish I could do is make an image the goes over top of the background and make it the only walkable/unwalkable area...
Code:--MAP 1---------------------------------------------------------------------------- if map == 0 then if CleoY >= 216 then map = 1 CleoY = 0 MobX = 350 MobY = 70 end if CleoY <= 12 then dontmoveoff = false CleoY = 12 end if CleoX <= -18 then map = 3 CleoX = 440 MobX = 200 MobY = 150 end if CleoX >= 441 then map = 5 CleoX = 0 MobX = 150 MobY = 70 end if CleoX <= 49 and CleoY <=133 then dontmoveoff = false if pad:left() then CleoX = 49 elseif pad:left() and pad:up() then CleoX = CleoX + 3 CleoY = CleoY + 3 else CleoY = 133 end end if CleoX >= 219 and CleoY <=48 then dontmoveoff = false if pad:right() and cleoright then CleoX = 219 elseif pad:up() and pad:right() then CleoY = CleoY + 3 CleoX = CleoX + 3 elseif pad:up() and pad:left() then CleoY = CleoY + 3 CleoX = CleoX - 3 else CleoY = 48 end end if CleoX >= 414 and CleoY <=180 then dontmoveoff = false if pad:right( ) then CleoX = CleoX - 3 else CleoY = CleoY - 3 end end ------------------------------------------------------------- if MobY >= 216 then MobY = 216 end if MobY <= 12 then dontmoveoff = false MobY = 12 end if MobX <= -18 then MobX = -18 end if MobX >= 441 then MobX = 441 end if MobX <= 49 and MobY <=133 then dontmoveoff = false if mobwalkleft then MobX = 49 else MobY = 133 end end if MobX >= 219 and MobY <=48 then dontmoveoff = false if mobwalkright then MobX = 219 elseif mobwalkup then MobY = 48 end end if MobX >= 414 and MobY <=180 then dontmoveoff = false if mobwalkright then MobX = 414 else MobY = 180 end end end --MAP 1 END
ALSO!!!
When I pin a monster against the wall if I hold down X (attack) it keeps doing it....
Code:--ATTACKING--------------------------------------------------------------------------- if not quitting then if not pad:cross() then Voicefx.Voicesound = false end if pad:cross() and not pad:triangle() and not pad:square() and not pad:circle() then if pad:cross( ) then if not Voicefx.Voicesound then Voice:play( ) Voicefx.Voicesound = true end else Voicefx.Voicesound = false end buttonpress = 1 screen:blit(340,0,menu[buttonpress]) if cleodown then direction = 5 end if cleoleft then direction = 6 end if cleoright then direction = 7 end if cleoup then direction = 8 end screen:blit(CleoX,CleoY,cleo[direction]) --ATTACKDAMAGE----------------------------------------------------------------- if MobX - 40 <= CleoX and CleoX <= MobX + 40 and MobY - 50 <= CleoY and CleoY <= MobY + 40 then Stab:play( ) if cleoup then MobY = MobY - 20 elseif cleoleft then MobX = MobX - 20 elseif cleoright then MobX = MobX + 20 elseif cleodown then MobY = MobY + 20 end end end end
-
03-27-2007, 06:13 PM #6401QJ Gamer Green
- Registriert seit
- Jan 2007
- Ort
- beside my PC
- Beiträge
- 520
- Points
- 6.446
- Level
- 52
- Downloads
- 0
- Uploads
- 0
thats a cool game..
but i dont know collision sryy...
-
03-27-2007, 06:40 PM #6402.info

- Registriert seit
- Jun 2006
- Ort
- ACT, Australia
- Beiträge
- 1.674
- Points
- 15.395
- Level
- 80
- Downloads
- 0
- Uploads
- 0
Does anyone know how i can return a table of the RGBA values of a color?
-
03-27-2007, 06:53 PM #6403
a = color:colors()
then you have a.r a.g a.b and a.a (red, greeb, blue, alpha)牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
03-27-2007, 06:53 PM #6404Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
i dont know if there are bit operations in lua. if there are, then icould write a function for you. its not hard with bits shifting.
Zitat von Yongobongo
-= Double Post =-
heh, that was easier ;)
Zitat von youresam
Geändert von Grimfate126 (03-27-2007 um 06:54 PM Uhr) Grund: Automerged Doublepost
--------------------------------------------------------------------------------------
-
03-27-2007, 06:55 PM #6405QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
for instance:
blah = Color.new(37,198,255,100)
blahcolors = blah:colors()
blahcolors.r returns 198
blahcolors.a returns 100
etc
-
03-27-2007, 07:00 PM #6406.info

- Registriert seit
- Jun 2006
- Ort
- ACT, Australia
- Beiträge
- 1.674
- Points
- 15.395
- Level
- 80
- Downloads
- 0
- Uploads
- 0
Thanks, can i use these values to tell one of the values?
Say
Code:fff = Color.new(111,234,983,255) colorz = fff:colors() colorz.a = alphavalue
-
03-27-2007, 07:23 PM #6407QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Yep, colorz.a right there would be the alpha value, 255.
-
03-27-2007, 07:27 PM #6408.info

- Registriert seit
- Jun 2006
- Ort
- ACT, Australia
- Beiträge
- 1.674
- Points
- 15.395
- Level
- 80
- Downloads
- 0
- Uploads
- 0
Alright thanks
now to go try it out
-
03-27-2007, 07:27 PM #6409
Sorry for asking this, but how do you display an image for only a few seconds in C (not in lua)? None of the C developers were online, so i thought maybe both in lua and C, the function was the same.
-
03-27-2007, 07:36 PM #6410.info

- Registriert seit
- Jun 2006
- Ort
- ACT, Australia
- Beiträge
- 1.674
- Points
- 15.395
- Level
- 80
- Downloads
- 0
- Uploads
- 0
Make a timer and blit it while the timer is under 3000 or however long you want it there
-= Double Post =-
Why isn't this working??
Code:color2= Color.new(110,132,255,100); if menuOnFocus == 3 then if pad:left() then if sliderLocation2 > 1 then sliderLocation2 = sliderLocation2 - 1 end end if pad:right() then if sliderLocation2 < 99 then sliderLocation2 = sliderLocation2 + 1 end colorz = color2:colors() color2 = Color.new(colorz.r, colorz.g, colorz.b, sliderLocation2*2.55
Geändert von Yongobongo (03-27-2007 um 10:36 PM Uhr) Grund: Automerged Doublepost
-
03-28-2007, 05:09 AM #6411QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
You didn't close the parenthesis on the last color.new and you didnt close all your ifthens.
-
03-28-2007, 01:07 PM #6412Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
you have a semicolon beside your first color.
Zitat von Yongobongo
wow, come on. those are the easiest things to spot. cant miss stuff like that. and also, you need to start indenting. a somple tab is all it takes, and it makes the code SO much easier to read. for example, ill indent your code:
Code:color2= Color.new(110,132,255,100) if menuOnFocus == 3 then if pad:left() then if sliderLocation2 > 1 then sliderLocation2 = sliderLocation2 - 1 end end end if pad:right() then if sliderLocation2 < 99 then sliderLocation2 = sliderLocation2 + 1 end end colorz = color2:colors() color2 = Color.new(colorz.r, colorz.g, colorz.b, sliderLocation2*2.55)
--------------------------------------------------------------------------------------
-
03-28-2007, 03:20 PM #6413QJ Gamer Gold
- Registriert seit
- Aug 2006
- Ort
- Under Your Bed
- Beiträge
- 3.083
- Points
- 12.189
- Level
- 72
- Downloads
- 0
- Uploads
- 0
Yeah you really shouldn't post especially even after luaplayer tells you what and where the error is...
-
03-28-2007, 04:20 PM #6414.info

- Registriert seit
- Jun 2006
- Ort
- ACT, Australia
- Beiträge
- 1.674
- Points
- 15.395
- Level
- 80
- Downloads
- 0
- Uploads
- 0
Luaplayer didn't give an error :|
It just doesnt seem to change the Alpha Value
-
03-28-2007, 04:23 PM #6415QJ Gamer Gold
- Registriert seit
- Aug 2006
- Ort
- Under Your Bed
- Beiträge
- 3.083
- Points
- 12.189
- Level
- 72
- Downloads
- 0
- Uploads
- 0
Yeah but someone with your history of releases I'd of thought things like this would come easy to you.
-
03-28-2007, 05:50 PM #6416.info

- Registriert seit
- Jun 2006
- Ort
- ACT, Australia
- Beiträge
- 1.674
- Points
- 15.395
- Level
- 80
- Downloads
- 0
- Uploads
- 0
I've just posted the snippet, the actual script runs fine and i've checked over it numerous times and there doesn't seem to be an error
oh well forget alpha
-
03-28-2007, 07:41 PM #6417
Lua supports semicolons.
Zitat von Grimfate126
is the same asCode:a = 5 b = 6
Code:a = 5; b = 6;
牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
03-28-2007, 07:46 PM #6418
I have a question. For shooting i tryed using the example at Evilmana( i changed some things but still didn't like it i am still learnig lua jsut started up again) But when you shoot you can only shoot five on the screen at a time. I was wondereing how you do shooting bullets like in ATOM. My game is kind of like it but it will end up being a lot different.
Thanks Bob Hoil:)
-
03-28-2007, 07:57 PM #6419
Use a table.
牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
03-28-2007, 08:24 PM #6420QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
And table.getn. And table.insert. And that's all anybody will probably tell you because they want you to figure it out.


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