![]() |
| Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact |
| ||||||
This is a discussion on PSP PGE Lua Player Tutorials by FaT3oYCG. within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; Contents: Introduction – A short introduction. Lesson 1 – The fundamental loop. Lesson 2 – Loading and printing text to ...
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 |
![]() 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
|
Contents:
Introduction – A short introduction. Lesson 1 – The fundamental loop. Lesson 2 – Loading and printing text to the screen. Lesson 3 – Loading and displaying images on the screen. Lesson 4 – Detecting and acting upon button changes. Lesson 5 – Adding sound to you game. Lesson 6 – Manipulating data from a file (Reading and Writing). Lesson 7 – Directory management and manipulation. Lesson 8 – Using networking in your game. Introduction: In the following tutorials I will be teaching you how to code in Lua using the PGE Candidate of Lua Player for the PSP. I will not however be teaching you the basics of the Lua programming language. Some things you should know before starting to follow these tutorials are methods such as “if condition then end”, “while condition do end”, “local” and comments. If you would like to request a tutorial that is not already planned then please feel free to post a reply suggesting that I cover that topic. Please note that I am creating these tutorials in my free time which I do not have enormous amounts of and the tutorials planned do not have set deadlines to be created by so please bare with me. Also if you find anything that I post in these tutorials to be wrong, hard to read or inaccurate then please point them out.
__________________
------ 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). Last edited by FaT3oYCG; 09-25-2009 at 10:23 AM.. |
|
|
|
|
|
#2 |
![]() 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
|
Lesson 1 – The fundamental loop.
The most basic loop that you should use should look something like the following. Code:
-- local variableName = value while pge.running() do pge.controls.update() pge.gfx.startdrawing() pge.gfx.clearscreen() -- Events pge.gfx.enddrawing() pge.gfx.swapbuffers() end
__________________
------ 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). |
|
|
|
|
|
#3 |
![]() ![]() Developer
|
Guess that Lesson 6 will not cover only basics about reading data from files ? Cause I'd rather prefer Reading/Writing data from files.
Anyway,awesome.Thanks for the good work you're doing.
__________________
00:00: Windows is loading...Come back tomorrow. 01:00 : Booting done.Not yet errors encountered... 01:10: Fatal error.Windows has been detected on logical drive 01:22: Keyboard Locked, try everything. 01:42 : Mouse Device Pilot not found, or uninstalled.Press Left-Bouton to continue. 01:50 : Ending User session.Do you want to play another game ? 01:59: Not enough memory.Only 508'312'583 bytes available. 02:00 : System is shutting Down. |
|
|
|
|
|
#4 |
![]() 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
|
Thanks for pointing that out I will cover reading and writing to files completely.
__________________
------ 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). |
|
|
|
|
|
#5 |
![]() 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
|
O.K. Lesson 2 is covering loading a font and then printing some text to the screen.
So to begin with we need to know some of the most basic commands for loading, activating and displaying a font on the screen and I will also add in the function for crating colours into the mix so we will be able to see what we have done. The function to load a font in PGE is pge.font.load() which is simple enough. Before we use the font we need to something called activating it, we need to do this so that the current texture that PGE will use will be the font and not any previous image or anything else that would cause it not to display right the function to do this is pge.font.activate() or fontName:activate(). The final functions that we need to know about are the pge.font.print() and pge.font.printcenter() these can also be used as fontName:print() and fontName:printcenter() which do what they say print text to the screen. The function to create a colour is pge.gfx.createcolor() which does what it says aswell. Now that you know about the functions and what they do we will get on with some code. I will explain what the code does at the end of the tutorial like usual and then you can play around with it and try changing things if you want. Code:
local verdana12 = pge.font.load(“./verdana.ttf”, 12) local green = pge.gfx.createcolor(0, 255, 0) while pge.running() do pge.controls.update() pge.gfx.startdrawing() pge.gfx.clearscreen() verdana12:activate() verdana12:printcenter(136, green, “Hello World :P”) pge.gfx.enddrawing() pge.gfx.swapbuffers() end
__________________
------ 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). Last edited by FaT3oYCG; 09-28-2009 at 01:22 PM.. |
|
|
|
![]() |
| Tags |
| fat3oycg , lua , pge , player , psp , tutorials |
| Thread Tools | |
|
|