[LUA] Need help with code plz
Forum rules
Forum rule Nº 15 is strictly enforced in this subforum.
Forum rule Nº 15 is strictly enforced in this subforum.
Re: [LUA] Need help with code plz
That will stop the loop inside the function from running.
Advertising
-
- Posts: 130
- Joined: Thu Jun 07, 2012 9:28 pm
Re: [LUA] Need help with code plz
What?
Your post needs more context.
Your post needs more context.
Advertising
-
- Posts: 188
- Joined: Wed Oct 24, 2012 11:49 pm
- Contact:
Re: [LUA] Need help with code plz
For some reason my images aren't showing on my psp screen, why is that?
-
- Guru
- Posts: 2874
- Joined: Sat Apr 21, 2012 1:23 pm
- Location: The North Pole
Re: [LUA] Need help with code plz
It is most likely an error in your code. I can't say much more since you haven't posted your code.
PSP 2001 - TA-085 - 6.61 PRO-C2
PS Vita 3G - PCH-1101 - 3.65 HENkaku Ensō
Alcatel phone - Android 8.1.0
Laptop - Toshiba Satellite L305D-S5974 - Ubuntu 16.04 LTS
PS Vita 3G - PCH-1101 - 3.65 HENkaku Ensō
Alcatel phone - Android 8.1.0
Laptop - Toshiba Satellite L305D-S5974 - Ubuntu 16.04 LTS
-
- Posts: 188
- Joined: Wed Oct 24, 2012 11:49 pm
- Contact:
Re: [LUA] Need help with code plz
qwikrazor87 wrote:It is most likely an error in your code. I can't say much more since you haven't posted your code.
Code: Select all
--Created by dragonxtamer596
--On the 10/25/12
Room_width = 480
Room_height = 272
player1x =240
player1y =136
---Load Sprites ---
background =Image.load ("images/Background.PNG")
player1=Image.load("images/Player1.PNG")
------functions
function checkcontrols()
pad = Controls.read()
if pad:start() then
break
end
if pad:right() then
player1x = player1x +2
end
if pad:left() then
player1x = player1x -2
end
if pad:up() then
player1y = player1y -2
end
if pad:down() then
player1y = player1y +2
end
end
function drawall()
screen:blit (0,0,background)
screen:blit(player1x,player1y,player1)
screen.waitVblankStart()
screen.flip()
end
-- MAIN LOOP
while true do
checkcontrols()
drawall()
end
-
- Guru
- Posts: 2874
- Joined: Sat Apr 21, 2012 1:23 pm
- Location: The North Pole
Re: [LUA] Need help with code plz
Try removing the spaces before "(" in the red areas.dragonxtamer596 wrote:--Created by dragonxtamer596
--On the 10/25/12
Room_width = 480
Room_height = 272
player1x =240
player1y =136
---Load Sprites ---
background =Image.load ("images/Background.PNG")
player1=Image.load("images/Player1.PNG")
------functions
function checkcontrols()
pad = Controls.read()
if pad:start() then
break
end
if pad:right() then
player1x = player1x +2
end
if pad:left() then
player1x = player1x -2
end
if pad:up() then
player1y = player1y -2
end
if pad:down() then
player1y = player1y +2
end
end
function drawall()
screen:blit (0,0,background)
screen:blit(player1x,player1y,player1)
screen.waitVblankStart()
screen.flip()
end
-- MAIN LOOP
while true do
checkcontrols()
drawall()
end
Also check that the images do not exceed the 512 by 512.
If those aren't the problems then I don't know what's going wrong.
PSP 2001 - TA-085 - 6.61 PRO-C2
PS Vita 3G - PCH-1101 - 3.65 HENkaku Ensō
Alcatel phone - Android 8.1.0
Laptop - Toshiba Satellite L305D-S5974 - Ubuntu 16.04 LTS
PS Vita 3G - PCH-1101 - 3.65 HENkaku Ensō
Alcatel phone - Android 8.1.0
Laptop - Toshiba Satellite L305D-S5974 - Ubuntu 16.04 LTS
-
- Posts: 188
- Joined: Wed Oct 24, 2012 11:49 pm
- Contact:
Re: [LUA] Need help with code plz
Have any links to get me headed in the right direction for making an rpg? Also is there a better, easier language out there for 2d psp with a lot of tutorials?
-
- Posts: 130
- Joined: Thu Jun 07, 2012 9:28 pm
Re: [LUA] Need help with code plz
http://www.koonsolo.com/news/make-rpg-by-yourself/dragonxtamer596 wrote:Have any links to get me headed in the right direction for making an rpg? Also is there a better, easier language out there for 2d psp with a lot of tutorials?
http://www.darkshire.net/jhkim/rpg/theo ... nning.html
There are better ones, not sure about easier.
-
- Posts: 188
- Joined: Wed Oct 24, 2012 11:49 pm
- Contact:
Re: [LUA] Need help with code plz
http://www.koonsolo.com/news/make-rpg-by-yourself/ ......... then what should i start with if an rpg is a bad idea.Different55 wrote:http://www.koonsolo.com/news/make-rpg-by-yourself/dragonxtamer596 wrote:Have any links to get me headed in the right direction for making an rpg? Also is there a better, easier language out there for 2d psp with a lot of tutorials?
http://www.darkshire.net/jhkim/rpg/theo ... nning.html
There are better ones, not sure about easier.
-
- Posts: 188
- Joined: Wed Oct 24, 2012 11:49 pm
- Contact:
Re: [LUA] Need help with code plz
nvm i've got itdragonxtamer596 wrote:http://www.koonsolo.com/news/make-rpg-by-yourself/ ......... then what should i start with if an rpg is a bad idea.Different55 wrote:http://www.koonsolo.com/news/make-rpg-by-yourself/dragonxtamer596 wrote:Have any links to get me headed in the right direction for making an rpg? Also is there a better, easier language out there for 2d psp with a lot of tutorials?
http://www.darkshire.net/jhkim/rpg/theo ... nning.html
There are better ones, not sure about easier.
my old code number generator
Code: Select all
-- My Second Lua Program
-- Author: Dragonxtamer596
red = Color.new(255, 0, 0)
function checkcontrols()
pad = Controls.read()
if pad:start() and oldpad:start() ~= pad:start() then
choice = math.ceil(math.random(1, 3))
end
if choice == 1 then
screen.print(200, 100, "1", red)
end
if choice == 2 then
screen.print(200, 100, "2", red)
end
if choice == 3 then
screen.print(200, 100, "3", red)
end
while true do
oldpad = Controls.read()
screen:clear()
screen.flip()
screen.waitVblankStart()
end
end
Code: Select all
grass = Image.load("grass.png")
player = Image.load("player.png")
flower = Image.load("flower.png")
screenwidth = 480 - player:width()
screenheight = 272 - player:width()
Player = { }
Player[1] = { x = 200, y = 50 }
-- Function to check player movements
function playerMovement()
pad = Controls.read()
if pad:left() and Player[1].x > 0 then
Player[1].x = Player[1].x - 2
end
if pad:right() and Player[1].x < screenwidth then
Player[1].x = Player[1].x + 2
end
if pad:up() and Player[1].y > 0 then
Player[1].y = Player[1].y - 2
end
if pad:down() and Player[1].y< screenheight then
Player[1].y = Player[1].y + 2
end
end
-- Function to paste images to screen
function pasteImages()
for a = 0, 14 do
for b = 0,8 do
screen:blit(32 * a, 32 * b, grass)
end
end
screen:blit(100,100,flower)
screen:blit(300,220,flower)
screen:blit(Player[1].x,Player[1].y,player)
end
-- Main Loop
while true do
screen:clear()
pasteImages()
playerMovement()
screen.waitVblankStart()
screen.flip()
end