![]() |
| Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact |
| ||||||
This is a discussion on move image over and keep it there within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; alright, im learning LUA, so i wanna make it when you hti right ti moves character over and keeps him ...
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 |
|
alright, im learning LUA, so i wanna make it when you hti right ti moves character over and keeps him there. right now the code i wrote, it moves it but when i release right it moves it back to original position
Code:
pad = Controls.read()
x = 60
y = 40
if pad:right() then
x = x + 5
y = y +5
end
screen:blit(x, y, person)
screen.flip()
|
|
|
|
|
|
|
#2 |
|
Mm.. I don't know LUA, but from what I can tell your creating two variables (x and y) and assigning them values, then providing a "keypad listener" to look for a right press to change those variable values.
The problem being that the variables will change back once this if statement is over. Should you not create the variables and leave them empty then create an "if else" type statement to control the image.. please note this code is not real and simply an idea to try and help Code:
if pad:right() then
x = 65
y = 45
else
x = 60
y = 40
end
, simply trying to give you idea's.
|
|
|
|
|
|
|
#3 |
![]() |
i don't know lua, but i think it's because you've assigned the variables inside of the function. every time you read the controls, the x and y are reset (because they are after the controls.read statement). put setting x and y as part of the loading function (does lua even work in functions?) instead of whenever the control pad is read.
[EDIT] i think the guy above me would also have the same problem you're having, because it's telling the PSP "if you're not holding the controller to the right, then reset the image," which is exactly what you don't want to do... |
|
|
|
|
|
#4 | |
|
Quote:
..
|
||
|
|
|
|
|
#6 | |
![]() ![]() OMFG
|
Quote:
|
|
|
|
|
![]() |
| Tags |
| image , move |
| Thread Tools | |
|
|