![]() |
| Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact |
| ||||||
This is a discussion on Lua Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; sigh, my code was perfect for what you wanted, if you set the directionFlag to 0 in my code then ...
![]() |
|
|
LinkBack | Thread Tools |
|
|
#10171 |
![]() Developer and Tutor.
My Mood:
Join Date: Jul 2007
Real First Name: Craig
Location: Widnes, England
Just Played: Life.
Posts: 1,646
Trader Feedback: 0
|
sigh, my code was perfect for what you wanted, if you set the directionFlag to 0 in my code then it stops moving, to fade in and out pictures you would have to use transparency and set the alpha value, i suggest you use pge luaplayer
__________________
------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference. My Website: is down for a while ... I'll bring a new one back soon. Currently working on: (0) PGE Gears Of War - On hold (Very large project). (0) PS???? - A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix). |
|
|
|
|
|
#10172 | ||
![]() ![]() Developer
|
Quote:
Quote:
__________________
[Blog] [Portfolio] [Homebrew Illuminati - Serious Homebrew Development Forums] [I want to make Homebrew FAQ] [How I broke into the Games Industry] [Programming Book List] [Programming Article List] |
||
|
|
|
|
|
#10173 | ||
|
Quote:
Quote:
could we slow it a little more? |
|||
|
|
|
|
|
#10174 | |
![]() Enter Custom Title
|
Quote:
Anyway, Mtype has a range from 1-4, you check if Mtype == 1-4. If Mtype isn't in the range of 1-4 then you've 'stopped' whatever you were moving. It doesn't get easier than that. You can have it as fast/slow as you want it, use a float i.e 0.2345. |
|
|
|
|
|
|
#10175 |
|
get clear of it...
another problem appears the lua skipped the command " Message("嘿~跑得了和尚跑不了庙,你们能往 哪里逃?","LiXiaoYao","001"," 李逍遥",false)" Code:
--┍━━━━━━━━━━━━━━━━━━━━━━━━━━━━┑
--│Windows XP For PSP │
--│制作人:胡鹏伟 │
--│联系我:QQ:315362463 E—mail:hupengweide@sina.com │
--┕━━━━━━━━━━━━━━━━━━━━━━━━━━━━┙
--###########################################################
--■ 0000002.lua
-------------------------------------------------------------
-- 本部分主要用于储存地图0000002的内容。(罗刹洞口)
--###########################################################
--背景图片
MapBack = Image.load("Pictures/Maps/0000002/Stage0000002.png")
--背景音乐
--可行动区域
--事件位置与内容
event={}
event[1]={x=1,y=1,runtype=true,move=false}
event[2]={x=1,y=1,runtype=false,move=false}
event[3]={x=1,y=1,runtype=false,move=false}
event[4]={x=1,y=1,runtype=false,move=false}
function Event(num)
if num == 1 then
img1 = Image.load("Pictures/Maps/0000002/Event1.png")
x=480
y = 270
while y>130 do
screen:blit(0,0,MapBack)
screen:blit(x,y,img1)
x=x-2
y=y-1
screen.flip()
screen.waitVblankStart()
end
Message("嘿~跑得了和尚跑不了庙,你们能往哪里逃?","LiXiaoYao","001","李逍遥",false)
screen:clear()
screen:blit(0,0,MapBack)
screen:blit(x,y,img1)
while y>100 do
screen:blit(0,0,MapBack)
screen:blit(x,y,img1)
x=x-2
y=y-1
screen.flip()
screen.waitVblankStart()
end
end
end
Code:
--┍━━━━━━━━━━━━━━━━━━━━━━━━━━━━┑
--│Windows XP For PSP │
--│制作人:胡鹏伟 │
--│联系我:QQ:315362463 E—mail:hupengweide@sina.com │
--┕━━━━━━━━━━━━━━━━━━━━━━━━━━━━┙
--###########################################################
--■ Function_Message
-------------------------------------------------------------
-- 本部分主要用于显示对话框。
--###########################################################
function Message(text,person,number,name,l_side)
SaveScreen(0,0,480,272,scr)
Mback=Image.load("Pictures/System/Message.png")
Mperson=Image.load("Pictures/Heads/"..person.."/"..number..".png")
Mname=Image.load("Pictures/System/ShowName.png")
--定位图片,定位
local mx =1
local my =1
local sx =1
local sy =1
if l_side==1 then
mx=0
my=152
sx=97
sy=210
nx=97
else
mx=480-Mperson:width()
my=152
sx=10
sy=210
nx=264
end
--处理文字信息
local lines={}
lines[1]=string.sub(text,1,46)
lines[2]=string.sub(text,47,92)
lines[3]=string.sub(text,93,138)
while true do
if pad:circle() then
break
end
screen:clear()
screen:blit(0,0,scr)
screen:blit(0,192,Mback)
screen:blit(mx,my,Mperson)
screen:blit(nx,160,Mname)
GbkPrint(nx+30,168,name,yellow)
GbkPrint(sx,sy,lines[1],white)
GbkPrint(sx,sy+16,lines[2],white)
GbkPrint(sx,sy+32,lines[3],white)
screen.flip()
screen.waitVblankStart()
end
end
function SaveScreen(left,top,width,height,scr)
scr = scr or screen
if scr ~= screen then
tmp_canvas = Image.createEmpty(width,height)
tmp_canvas:blit(0,0,scr,left,top,width,height)
else
screen.flip()
tmp_canvas = Image.createEmpty(width,height)
tmp_canvas:blit(0,0,scr,left,top,width,height)
screen.flip()
end
end
|
|
|
|
|
|
|
#10181 |
![]() Developer and Tutor.
My Mood:
Join Date: Jul 2007
Real First Name: Craig
Location: Widnes, England
Just Played: Life.
Posts: 1,646
Trader Feedback: 0
|
haha you just gotta love Nielkie
.
__________________
------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference. My Website: is down for a while ... I'll bring a new one back soon. Currently working on: (0) PGE Gears Of War - On hold (Very large project). (0) PS???? - A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix). |
|
|
|
|
|
#10182 |
|
problem happened again!
When i used the comand"ShowStage(4,12,9)" ,i get an message: can't compare nil with a number i don`t know why. i put the following between "local dxmax=MapBack:width()/16 local dymax=MapBack:height()/16" and" if dx<dxmax+1 and dx>0 then if dy<dymax+1 and dy>0 then".To my surprise ,dx and dy is nil??? writing codes is a really confusing thing...... Code:
while true do screen:clear() GbkPrint(0,0,Moveable[9][11],white) GbkPrint(0,16,dx..dy,white) GbkPrint(0,32,px..py,white) screen.flip() screen.waitVblankStart() end Code:
function JudgeMove(direction,px,py)
if dircetion==4 then
dx=px-1
dy=py
end
if direction==6 then
dx=px+1
dy=py
end
if direction==8 then
dx=px
dy=py-1
end
if direction==2 then
dx=px
dy=py+1
end
local dxmax=MapBack:width()/16
local dymax=MapBack:height()/16
--出界判定
if dx<dxmax+1 and dx>0 then
if dy<dymax+1 and dy>0 then
--不可行动区域判定
if Moveable[dy][dx]==1 then
--事件阻挡判定
if MapEvent[dx][dy]~=1 then
return true
end
end
end
end
end
|
|
|
|
|
|
|
#10183 |
![]() ![]() Developer
|
Code:
if dircetion==4 then
__________________
[Blog] [Portfolio] [Homebrew Illuminati - Serious Homebrew Development Forums] [I want to make Homebrew FAQ] [How I broke into the Games Industry] [Programming Book List] [Programming Article List] |
|
|
|
|
|
#10185 |
![]() ![]() Developer
|
|
|
|
|
|
|
#10186 |
![]()
My Mood:
Join Date: Jan 2008
Real First Name: Chris
Location: Iowa
Just Played: Brave Story: New Traveler
Posts: 297
Trader Feedback: 0
|
im trying to figure out how the 3d functions in lua player work, so i modifyed the cube demo:
Code:
System.usbDiskModeActivate()
-- Colors
red = Color.new(255, 0, 0)
orange = Color.new(255, 140, 0)
yellow= Color.new(255, 255, 0)
green = Color.new(0, 255, 0)
blue = Color.new(0, 0, 255)
blue2 = Color.new(30, 144, 255)
blue3 = Color.new(16, 78, 139)
blue4 = Color.new(25, 25, 112)
purple = Color.new(153, 50, 204)
pink = Color.new(255, 110, 199)
black = Color.new(0, 0, 0)
brown = Color.new(107, 66, 38)
white = Color.new(255, 255, 255)
grey = Color.new(84, 84, 84)
light_grey = Color.new(211, 211, 211)
silver = Color.new(230, 232, 250)
-- Move Values
movX = 0
movY = 0
movZ = -10
extra = 0
-- Rotate Values
rotX = 0
rotY = 0
rotZ = 0
-- Loads Seamless Image To Tile On Cube
logo = Image.createEmpty(64, 64)
logo:clear(silver)
logo:print(5, 8, "Lua", black)
logo:print(10, 17, "3D", black)
require("System\\analog")
require("System\\cube")
while true do
pad = Controls.read()
screen:clear(white)
analogSet(1,1)
Gu.start3d()
-- clear screen
Gu.clearDepth(0);
Gu.clear(Gu.COLOR_BUFFER_BIT|Gu.DEPTH_BUFFER_BIT)
-- setup projection and view matrices
Gum.matrixMode(Gu.PROJECTION)
Gum.loadIdentity()
-- perspective length, ratio(15/8.5 is psp screen), how close to screen you can get to object before break point
Gum.perspective(25, 15/8.5, .5, 10000)
Gum.matrixMode(Gu.VIEW)
Gum.loadIdentity()
-- setup texture
Gu.enable(Gu.BLEND)
Gu.enable(Gu.TEXTURE_2D);
Gu.texImage(logo)
-- Colors/Textures Object
Gu.texFunc(Gu.TFX_MODULATE, Gu.TCC_RGBA)
-- Makes Smooth
Gu.texEnvColor(white)
Gu.texFilter(Gu.LINEAR, Gu.LINEAR)
-- Scale of Texture, large number small texture is, slower fps
Gu.texScale(.25, .25)
-- setup matrix for cube
Gum.matrixMode(Gu.MODEL)
Gum.loadIdentity()
Gum.translate(movX, movY, movZ)
Gum.rotateXYZ(rotX, rotY, rotZ)
-- draw cube
Gum.drawArray(Gu.TRIANGLES, Gu.TEXTURE_32BITF|Gu.COLOR_8888|Gu.VERTEX_32BITF|Gu.TRANSFORM_3D, cube[0])
Gu.end3d()
if pad:start() then
break
end
screen.waitVblankStart()
screen.flip()
end
Code:
for i=0,3 do
cube[i] = {
-- Each 3 part section create a triagnle
-- unknown,unknown, color, x, y, z
{0, 0, red, -1+i, -1, 1}, -- 0
{2, 0, red, -1+i, 1, 1}, -- 4
{2, 2, red, 1+i, 1, 1}, -- 5
{0, 0, red, -1+i, -1, 1}, -- 0
{2, 2, red, 1+i, 1, 1}, -- 5
{0, 2, red, 1+i, -1, 1}, -- 1
{0, 0, orange, -1+i, -1, -1}, -- 3
{2, 0, orange, 1+i, -1, -1}, -- 2
{2, 2, orange, 1+i, 1, -1}, -- 6
{0, 0, orange, -1+i, -1, -1}, -- 3
{2, 2, orange, 1+i, 1, -1}, -- 6
{0, 2, orange, -1+i, 1, -1}, -- 7
{0, 0, yellow, 1+i, -1, -1}, -- 0
{2, 0, yellow, 1+i, -1, 1}, -- 3
{2, 2, yellow, 1+i, 1, 1}, -- 7
{0, 0, yellow, 1+i, -1, -1}, -- 0
{2, 2, yellow, 1+i, 1, 1}, -- 7
{0, 2, yellow, 1+i, 1, -1}, -- 4
{0, 0, green, -1+i, -1, -1}, -- 0
{2, 0, green, -1+i, 1, -1}, -- 3
{2, 2, green, -1+i, 1, 1}, -- 7
{0, 0, green, -1+i, -1, -1}, -- 0
{2, 2, green, -1+i, 1, 1}, -- 7
{0, 2, green, -1+i, -1, 1}, -- 4
{0, 0, blue, -1+i, 1, -1}, -- 0
{2, 0, blue, 1+i, 1, -1}, -- 1
{2, 2, blue, 1+i, 1, 1}, -- 2
{0, 0, blue, -1+i, 1, -1}, -- 0
{2, 2, blue, 1+i, 1, 1}, -- 2
{0, 2, blue, -1+i, 1, 1}, -- 3
{0, 0, purple, -1+i, -1, -1}, -- 4
{2, 0, purple, -1+i, -1, 1}, -- 7
{2, 2, purple, 1+i, -1, 1}, -- 6
{0, 0, purple, -1+i, -1, -1}, -- 4
{2, 2, purple, 1+i, -1, 1}, -- 6
{0, 2, purple, 1+i, -1, -1}, -- 5
}
end
|
|
|
|
|
|
#10188 |
![]() ![]() Developer
|
That's your error. LuaPlayer can't find the script file.
__________________
[Blog] [Portfolio] [Homebrew Illuminati - Serious Homebrew Development Forums] [I want to make Homebrew FAQ] [How I broke into the Games Industry] [Programming Book List] [Programming Article List] |
|
|
|
|
|
#10190 |
![]() Developer and Tutor.
My Mood:
Join Date: Jul 2007
Real First Name: Craig
Location: Widnes, England
Just Played: Life.
Posts: 1,646
Trader Feedback: 0
|
which version by which author?
PGE has a pge.net.getfile() function
__________________
------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference. My Website: is down for a while ... I'll bring a new one back soon. Currently working on: (0) PGE Gears Of War - On hold (Very large project). (0) PS???? - A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix). |
|
|
|
|
|
#10191 |
![]() ![]() Join Date: Sep 2009
Real First Name: Manak
Location: Some where
Just Played: PSP
Posts: 58
Trader Feedback: 0
|
Hey guys what's wrong with this code?
myfile = pge.file.open(”info.txt”, PGE_FILE_RDONLY) i get error message unexpected symbol near 'Ö'. The rest of my program is... Spoiler for OPEN:
-Manaxed.
__________________
Enter Signature Here. |
|
|
|
|
|
#10193 |
![]() ![]() Developer
|
Probably something wrong with the speech marks. ” is not the same as ".
__________________
[Blog] [Portfolio] [Homebrew Illuminati - Serious Homebrew Development Forums] [I want to make Homebrew FAQ] [How I broke into the Games Industry] [Programming Book List] [Programming Article List] |
|
|
|
|
|
#10195 |
|
My Mood:
Join Date: Apr 2009
Real First Name: Felix
Location: germany
Just Played: Monster Hunter 2
Posts: 41
Trader Feedback: 0
|
Can somebody tell me how to write something into a file by using SystemOSK?
I tried this: Code:
nickname = System.startOSK("","Enter your name")
name = io.open("name.txt","w")
name:write(nickname)
name:close()
|
|
|
|
![]() |
| Tags |
| code , lib , lua , luaplayer , noobs , programming , psp programming , scripting , thread |
| Thread Tools | |
|
|