thats a cool game..
but i dont know collision sryy...
Printable View
thats a cool game..
but i dont know collision sryy...
Does anyone know how i can return a table of the RGBA values of a color?
a = color:colors()
then you have a.r a.g a.b and a.a (red, greeb, blue, alpha)
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:
Zitat von Yongobongo
-= Double Post =-
heh, that was easier ;)Zitat:
Zitat von youresam
for instance:
blah = Color.new(37,198,255,100)
blahcolors = blah:colors()
blahcolors.r returns 198
blahcolors.a returns 100
etc
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
Yep, colorz.a right there would be the alpha value, 255.
Alright thanks :tup: now to go try it out
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.
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
You didn't close the parenthesis on the last color.new and you didnt close all your ifthens.
you have a semicolon beside your first color.Zitat:
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)
Yeah you really shouldn't post especially even after luaplayer tells you what and where the error is...
Luaplayer didn't give an error :|
It just doesnt seem to change the Alpha Value
Yeah but someone with your history of releases I'd of thought things like this would come easy to you.
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
Lua supports semicolons.Zitat:
Zitat von Grimfate126
is the same asCode:a = 5
b = 6
Code:a = 5;
b = 6;
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:)
Use a table.
And table.getn. And table.insert. And that's all anybody will probably tell you because they want you to figure it out.
Is there a way to us c/c++ code in a lua script? For instance would it be possible to modify some of the functions from Zettablade's vlib to to let them be used with the lua player, or would they have to compiled into the player itself?
You either have to compile it into luaplayer or load it as an lrx
Sorry, but I'm still a newbie, what's an lrx?
It's an extra library that lets you add more functions to your script
Ive used sysext lrx, for example that adds the ability to play .ogg, overclock the cpu, exit the application, launch static elf's etc.
Is an lrx a pre-compiled library, or is it like a script that can be edited?
It's a pre-compiled library. It's basically a .prx, with the L from LuaPlayer. :|Zitat:
Zitat von Merick
hey can i just have a menu coded in lua so i can learn from it and study cause i am learning lua now and want a menu thank you
Look in the code snippets thread, Its sticked in this forum.
ok but is there one that will help me with this type of menu
where there are 3 menu bgs with 3 options in them start credits and quit this is designed in
and the three images are
the first one is with the arrow pionting to start second one to credits and 3rd one to quit designed in not coded is there a menu in the snippets like that
So when you highlight an option, It will display the arrow picture next to it?
kinda if you want i can post the pics
Guess what i found in the snippets thread?
Just with some minor indention ;)
Spoiler for Keep guessing...:
A basic menu is not hard to make, just simply declare the amount of menu items and make something like this:
and so on.Code:if pad:up() then
menu = menu - 1
end
if pad:down() then
menu = menu + 1
end
if menu > 5 then -- if menu is over the maximum amount
menu = 1
end
if menu == 1 then -- if the menu is number 1
screen:blit(0,0,arrow)
end
if menu == 2 then -- if menu is number 2
screen:blit(0,10,arrow)
end
ok these are the images please no one copy these
menu1
http://i152.photobucket.com/albums/s...10594/WoC1.png
menu2
http://i152.photobucket.com/albums/s...10594/WoC2.png
menu3
http://i152.photobucket.com/albums/s...10594/WoC3.png
I think that could should be:Zitat:
Zitat von Yongobongo
I just changed some things in it. In your code, if you go above of the 5th option in the menu, the code resets to the 1st option. It should be 5th option if the menu goes above the 5th option. Vice versa for the minimum option.Code:if pad:up() then
menu = menu - 1
end
if pad:down() then
menu = menu + 1
end
if menu > 5 then -- if menu is over the maximum amount
menu = 5
end
if menu < 1 then -- if menu is below the minimum amount
menu = 1
end
if menu == 1 then -- if the menu is number 1
screen:blit(0,0,arrow)
end
if menu == 2 then -- if menu is number 2
screen:blit(0,10,arrow)
end
Just edit the code I posted to display your arrow instead of the arrow it makes.
Also edit it to blit the arrow on both sides.
Should be very simple, I just don't want to give you the code cause i would rather have you learn something ;)
ok thanks
-= Double Post =-
would it look something like this
code-
blue = Color.new(0, 153, 255)
orange = Color.new(155, 102, 0)
gray = Color.new(153, 153, 153)
black = Color.new(0 , 0, 0)
---Variables---
Select = 1
MaxSelect = 3
WOC1 = Image.load("images/WoC1.jpg")
WOC2 = Image.load("images/WoC2.png")
WOC3 = Image.load("images/WoC3.png")
---Loop----
while true do
pad = Controls.read()
screen:clear()
--Player decision---
if pad:down()
Select = Select + 1
end
if pad:up() then
Select = Select - 1
end
--Menu Options---
if Select == 1 then
screen:blit(0,0,WOC1)
screen:flip()
end
if Select == 2 then
screen:blit(0,0,WOC2)
screen:flip()
end
if Select == 3 then
screen:blit(0,0,WOC3)
screen:flip()
end
if Select < 1 then
screen:blit(0,0,WOC3)
screen:flip()
end
if Select > 3 then
screen:blit(0,0,WOC1)
end
screen:flip()
screen.waitVblankStart()
end
I think it should be:Zitat:
Zitat von superbatxs
Code:if pad:up() then
menu = menu - 1
end
elseif pad:down() then
menu = menu + 1
end
elseif menu => 4 then
menu = 1
end
elseif menu <= 0 then
menu = 3
end
elseif menu == 1 then
screen:blit(0,0,arrow)
end
elseif menu == 2 then
screen:blit(0,10,arrow)
end
elseif menu == 3 then
screen:blit(0,20,arrow)
end
does that look ok or needs workZitat:
Zitat von pspdude10594
So if a menu option is more than 4, make the menu option 1? Or if a menu option is equal to 4, make the menu option 1? It depends on the user. You can have a menu either way. Btw, I was talking about 5 menu options. Also, you don't have to have that. Instead ofZitat:
Zitat von Anti-QJ
you can putCode:elseif menu =>4 then
menu = 1
end
Btw, i am not sure if it needs an else if....you can just if alone.Code:if menu > 3 then
menu = 1
end
--Double post--
Just a simple code cleanup. Yea, that could work. Btw, you don't need the colors, unless you use them later.Code:--Variables
Select = 1
MaxSelect = 3
WOC1 = Image.load("images/WoC1.png")
WOC2 = Image.load("images/WoC2.png")
WOC3 = Image.load("images/WoC3.png")
---Loop----
while true do
pad = Controls.read()
--Player decision---
if pad:down()
Select = Select + 1
end
if pad:up() then
Select = Select - 1
end
--Menu Options---
if Select == 1 then
screen:blit(0,0,WOC1)
screen:flip()
end
if Select == 2 then
screen:blit(0,0,WOC2)
screen:flip()
end
if Select == 3 then
screen:blit(0,0,WOC3)
screen:flip()
end
if Select > 3 then
Select == 1
end
if Select < 1 then
Select == 3
end
screen.waitVblankStart()
end