i was just joking
Printable View
i was just joking
is there a way to change the font size in lua>???
yes
Font:setPixelSizes(w, h)
k thanks
Go read the documentation on luaplayer.org.
i was trying to learn c, then i went back to lua, and never got around to changing my sigZitat:
Zitat von slicer4ever
i've chagned it now
i'm having problems with substituting variables in a function.
t
his is the function:
i'm trying to replace every instance of guy1, guy1x, and guy1y, with guy2, guy2x, and guy2y.Code:function guyspawn(guy1, guy1x, guy1y)
if guy1 == true then
screen:blit(guy1x, guy1y, guy)
end
if cx > guy1x - 15 and cx < guy1x + 5 and
cy > guy1y - 15 and cy < guy1y + 25 and pad:cross() then
guy1 = false
guy1x = -16
guy1y = 220
end
if guy1x < 370 then
guy1x = guy1x + 1
end
if guy1x == 370 then
castlehealth = castlehealth - 1
end
end
I think it might be working, but it doesn't work properly. The function is supposed to make a guy scroll across the screen and disappear when i shoot it. But when i add in the (guy1x, guy1y, guy1y) and try to replace it with (guy2x, guy1y, guy2) in my while true statement, all it does is sit there, and not react when i shoot it.
well, i need help!
i'm trying to make a tic-tac-toe game
i've gotten to the part where you place the X's down
here's the code:
Spoiler for Code:
if you go to function player1(), it does say that if i press X, it should execute the function that makes X's, but nothing happens
another thing, when i'm on the 9th square, it says
if pad:right() and currentSquare == 9 then
currentSquare = currentSquare - 8
end
so that it goes to 1st square, it just disappears
download code here:
http://www.sendspace.com/file/noxhtl
once you've drawn the gameboard why are you doing nine more squares ?
eurg, i don't think you get it
let me give you screeny, that'll probably make it better
and when you hold the button? does cross appear?
nope, doesn't work
still working the screeny
edit: here, just take the code:
http://www.sendspace.com/file/noxhtl
doesn't need luaplayer
From looking at your code, you might be overcomplicating things. I've written my own tic tac toe game (Only tested in Windows Luaplayer) but maybe it will give you some ideas on how to streamline things a bit.
Spoiler for Code:
:P :o :(
o well, so maybe code ain't so great
/me stops working on tic tac toe and decides to go to wiki
anyways, thanks for help
Nonono, don't stop working on it. I have tons of code that I just made to get a handle on different aspects of programming theory. I just put this up to show how if you structure a function correctly, you shouldn't have to make 10 different versions of it. Plus my tic tac toe is the ugliest version of the game that you can get.
I made a tic tac toe game in my first course of VB.net. Coming with a background of a year of PSP C/++ programming knowledge, I made multiple AIs (random, offensive, defensive). My teacher then allowed me to go off and do my own thing, and then Irrlicht engine came to my attention... :twisted:
I agree with Klepto, just keep at it. If you're %50 done, come to a point where you realize your design has a flaw, or your design won't work to be %100, back to the drawing board (literally, write out designs on pen and paper)
fine :D
but i will stop for a bit just to look back at some more tutorials, etc
How can i launch an eboot from lua?
do you mean:
"How can I run my LUA program without using LUAPlayer?"
or literally, how do you run an eboot with a LUA script?
if it's the second one, i'm not sure if you can
The second one, well ok, but i assume i can add a function to do it in the LUA Player source?Zitat:
Zitat von michaelp
If yes, how? I know C++ but don't know how LUA Player works, also i'm not experienced in coding with C in the psp.
i don't know, i never actually looked at the luaplayer sourceZitat:
Zitat von luizlizard
You cant.
Humm, why? I already looked at the source code and it actually seems easyZitat:
Zitat von Anti-QJ
Of course you can add functions to luaplayer. You just need an SDK setup, the right libs, and a non-lua mindset as LuaPlayer is in C++.
Ok, i added the function to the source, but i only have the precompiled toolchain (pspdev) so i can't compile it, can someone compile it for me?
Here it is: http://luizlizard.pspsc.com/downloads/luasystem.cpp
And just add it to the regular Lua Player .20 source.
Thanks in Advance!!!
you don't need to know how Lua Player is designed to add functions to it. look at my mods (flashing capabilities, IR keyboard (didn't release as pi key released soon after and havent had a time to implement it into it) and some directory functions (dump umd, etc.)). It just takes some observational skills ;)
hey luizlizard when i compile lua player with the luasystem.cpp you made it just makes a black screen appear when i load it from my psp and i put the system and apps folder in and added lowser and all the oter stuff in the apps folder. but it compiles without errors do u know why coz i was trying to make one with all of the functions you included also can you add the nickName function the code is
-------------------------------
static int lua_nickName(lua_State *L)
{
if (lua_gettop(L) != 0) return luaL_error(L, "no arguments expected.");
char *namebuffer = "";
sceUtilityGetSystemParamS tring(1, namebuffer, 25);
lua_pushstring(L, namebuffer);
return 1;
}
-------------------------------
and the line is
-------------------------------
{"nickName", lua_nickName},
-------------------------------
sorry im new to this but can lua work on psp version 2.81?
You got to have a homebrew capable PSP firmware
xpack was trying to say no
-= Double Post =-
but i'm pretty sure with all these updates at qj you can downgrade your firmware now
Simple, how do I make an image display for a period of time, then go away when the player presses... say... X?
I already have the image loaded. :)
@ TheSilenceOfNoOne :
Here is a example for you if you want to only remove the image from the screen:
My_Image = Image.load("My_Image.png" )
while true do
pad = Controls.read()
if pad:cross() then
My_Image:clear()
end
screen:blit(0, 0, My_Image)
screen.waitVblankStart()
screen.flip()
end
----------
Or like this if you want to completely remove the image from memory and not just the screen
My_Image = Image.load("My_Image.png" )
Display_Image = true
while true do
pad = Controls.read()
if pad:cross() then
Display_Image = false
My_Image = nil
collectgarbage()
end
if Display_Image == true then
screen:blit(0, 0, My_Image)
end
screen.waitVblankStart()
screen.flip()
end
both of those are flawed...Zitat:
Zitat von Xx_FightStar_xX
you want a bool for when X is pressed, set to T/F depending on what its already at.
Then the image blitted based on that.
OK, so I am trying to do that with 3 images in a row.
Like this:?
Code:gbaxlogo = Image.load(other/slogo.png)
gamelogo = Image.load(other/loading.png)
teamlogo = other/Team.PNG)
screen:blit(480, 272, gbaxlogo)
while true do
pad = Controls.read()
if pad:cross() then
screen:clear()
while true do
screen:blit(480, 272, teamlogo)
if pad:cross() then
screen:clear()
while true do
screen:blit(480, 272, gamelogo)
if pad:cross() then
screen:clear()
end
or
while not Constrols.read():cross() do
screen:blit(x,y,image)
end
what you are trying to do is a bit complicated give me about 10 mins
8 mins later lol
heres what i suggest
CODE:
-----------------------------------------------------------------------
gbaxlogo = Image.load(other/slogo.png)
gamelogo = Image.load(other/loading.png)
teamlogo = other/Team.PNG)
white = Colour.new(255, 255, 255)
while true do
pad = Controls.read()
CI = 0
if
pad:cross() and CI == 0
then
screen:blit(0, 0, gbaxlogo)
CI = 1
end
if
pad:cross() and CI == 1
then
screen:blit(0, 0, teamlogo)
CI = 2
end
if
pad:cross() and CI == 2
then
screen:blit(0, 0, gamelogo)
CI = 3
end
if
CI == 3
then
screen:print(10, 10, now wasnt that cool, white)
CI = 0
end
screen.flip()
screen.waitVblankStart()
end
--------------------------------------------------
... noZitat:
Zitat von FaT3oYCG
what you have there will only blit the image the second 'x' is pressed. So you will basically never see it.
i'd just do:
it will cycle images everytime 'x' is pressed, and show nothing pst the third image ;)Code:img1 = Image.load("1.png")
img2 = Image.load("2.png")
img3 = Image.load("3.png")
variable = 0
while true do
screen:clear()
if variable == 0 then
screen:blit(0,0,img1)
elseif variable == 1 then
screen:blit(0,0,img2)
elseif variable == 2 then
screen:blit(0,0,img3)
end
pad = Controls.read()
if pad:cross() then
variable = variable + 1
end
screen.flip()
screen.waitVblankStart()
end
I would do something similar, except make it faster, more understandable and have it recyclable.
I believe you can do that in Lua.Code:image = { Image.load("1.png"), Image.load("2.png"), Image.load("3.png") }
image_num = 1
exit = false
while ~exit do
if Controls.read():cross() then
image_num = image_num + 1
if image_num > table.getn(image) then
image_num = 0
end
screen:clear()
screen:blit(0,0,image[image_num])
screen.waitVblankStart()
screen.flip()
elseif Controls.read():start() then
exit = true
end
end