if you look at the evil mana tut its not as easy as just changing some xy positions
he has it set up diferent
Printable View
if you look at the evil mana tut its not as easy as just changing some xy positions
he has it set up diferent
Sorry i dont have time to read all of your code but do you have a Controls.read(); at all to intialize the buttons?Zitat:
Zitat von Gonrai
Edit: nvm found it
size is 450kb...its like 15-20 secs long.Zitat:
Zitat von JoeDaStudd
can someone pleas post a snippet to find ur current FPS???
I wanted to add a typewriter effect but I get an error.
Code:-- EVILMANA.COM PSP LUA CODEBASE
-- www.evilmana.com/tutorials/codebase
-- Typewriter Effect for Text
-- SUBMITTED BY: dennis van den broek
-- Code : DS (dialogue system)
-- Autor: Dennis van den broek
white = Color.new(255, 255, 255)
-- initialise if the DS (dialogue system) should be called
DS_set = 0
-- strings used for the effect
DS_str = { }
DS_str[1] = "This is a typewriter machine test..."
DS_str[2] = "This code is a test which can be used freely,"
DS_str[3] = "in any type of game, credits are allways welcome"
-- temp string that stores the current to write string
write_str = ""
str_length = 0
-- counter for holding where on the string we are
i = 1
num = 1
-- sets the DS on or off
function init_DS(type)
if type == 1 then
DS_set = 1
else
DS_set = 0
num = 1
end
end
-- checks what string to write, function should be upgraded with detection of which
string to print
-- currently it's a simple placeholding code
function set_DS()
if num > 3 then
init_DS(0)
end
Typewriter(DS_str[num], 2, 10, 100)
end
-- the actual code, input the string you wanna print, and how many characters per
frame you wanna show up...
function Typewriter(str, speed, DSx, DSy)
read_str = str
str_length = string.len(read_str)
if i <= str_length then
i = i+speed
write_str = string.sub(read_str, 1, i)
screen:print(DSx, DSy, write_str, white)
else
screen:print(DSx, DSy, write_str, white)
if pad:cross() and oldpad:cross() ~= pad:cross() then
i = 0
num = num + 1
end
end
end
-- main while loop
while true do
pad = Controls.read()
if pad:cross() and oldpad:cross() ~= pad:cross() then
init_DS(1)
end
if DS_set == 1 then
set_DS()
end
screen.waitVblankStart()
screen.flip()
screen:clear()
oldpad = pad
end
how about you post the error... Why wouldnt you saying you need help?
And I dont have time to read through the code and see whats wrong, even with an the error, but I can say having any 'screen' calls after you flip the display buffer is pointless. remove the screen:clear, it has no effect.
I get this error.
Code:Error: index.lua:38 /=/ expected near /to/
Well, go to line 38, see if there is something there that shouldnt be... Looks to me that the comment got brought out of the -- segment, making an error... Simply add '--' before 'string' on line 38.
And on all of the other lines where comments are.
Ok I got it to work. Now If I want to exit my program, do I just inputCode:if pad:start() then
exit
I dont know Lua Players exit function... but you sure can cause a purposeful crash, and send you to the XMB.
I also heard 'os.exit()' works.
i think u need luaplayer .17dk2 or something like that tho.Zitat:
Zitat von SG57
os.exit exits to xmb. But is there a way to exit to luaplayer?
i think "break" (that only exits your loop, so if u put it in ur main loop, it should exit to luaplayer)Zitat:
Zitat von Shadox75
Actually, when Lua Player runs through the entire script, then does it return to Lua Player, or that weird Press STart to restart thing...
So ya, without an ifnite loop, or something stopping it from reaching hte end, then it goes to Lua Player.
hey how come this doesnt work...??? i want it to make it so when u press cross....you exit the game...
Code:menu = Image.load("menu5.png")
while true do
screen:blit(0,0,menu,true)
screen.waitVblankStart(1)
screen.flip()
pad = Controls.read()
if pad:up() then
dofile ("menu4.lua")
elseif pad:down() then
dofile("test.lua")
elsif pad:cross() then
break
end
end
Well what error does it give? Anyways you put elsif, instead of elseif.Zitat:
Zitat von altunozara
ok well i fixed that...so now its that code...but with elseif...it goes to the thing...but when its time to click x i click x...and nothing happens?
You don't use "break". The only way to exit back to the XMB is "System.Quit()". But this only works in the LuaPlayer Mod by Cools. You can get it at psplua.com
No, you can use "os.exit()" and it works on all versions of LuaPlayer.Zitat:
Zitat von ARza
That's news to me. I asked a question about this once, and the only answer I got was System.Quit() with the LuaPlayer mod.
os.exit() doesnt do anything for me
OK, I'm making that "game" that I made a thread about yesterday. I have all the movement done. What I want to do is make it so when you press X, it turns that square black. Well, I do an if/then statement, and of course, it stays on, then dissapears when you let go of X. The question I want to know is, how can I make that square stay black? And I don't want something like this:
if pad:cross() then
square_is_black = true
end
if square_is_black == true then
screen:blit(block)
end
If I did this, I would need over 3200 if/then statements. And I really don't want to do that.
use a table maybe?
What do you mean?Zitat:
Zitat von Glynnder
like into an array of black and white tiles.
Tiles = {
wwwwwwwwww
bbbbbbbbbb
wwbwbwbwbw
wbwbwbwbwb
wwwwwwwwww
}
and so on
OK, noob question, how would I change a vaiable from an array like that. For example
array = {
121010010
101010101
101001100
}
How would I change the 2 to a 1?
I think that would be a hard way of doing it lol cuz like a variable you would have to change the whole thing.
Well, does anyone know this. How would you change a variable in a table like this?
table = {}
table[1] = {1,0,1,0,1,1,1,0,1,0,1,1}
table[2] = {1,0,1,0,1,1,1,0,1,0,1,1}
table[3] = {1,0,1,0,1,1,1,0,1,0,1,1}
well each of those is still a variable tho... So you would still have to change the whole variable exept you would only have to do one row at a time.
Well, in a table like this:
table = {8,20,38,49}
I would just have to table[4] = 39 and it would change the value.
Could I just do this
table[3][6] = 0
EDIT: Turns out the above actually does work. I'm going to do that. Thanks for your help though.
Glad i could kinda help lol
I did help u eliminate other processes tho :D
Yeah, that helped me out. I could have spent hours trying those other ideas. :D
ok is there some kind of code for a magnet effect.
so like when x is pressed object one starts moving torwards object 2
OK, I'll give you an example where object 2 is on the right.
if object1.x < 0bject2.x and pad:cross() then
object1.x = object1.x + 4
end
So if object1 is farther to the left than object 2 and youi press x, then object 1 will start moving to the right.
yea i figured that out but i need it work despite where they are
like diagonal and stuff
you could create an invisible shape the surronds the one you want to keep the other shape away from and if the other shpae touches the invisible shape then it gets like, glued there?
thats not what im tryin to do here ill explain my game, the enemy scrolls left to right on top and i scroll l/r on bottom. i need him to fire at me where ever i am
ill use the magnet effect for the bullet so it draws torwards me
You just need to expand ARza's code to work in the y direction also. As long as you don't use "elseif," both statements will execute and it will move diagonally.
u dont understand, that keeps the bullet paths very limmited
ive already tried it