Quick Study
Before we get started making games, we need to get familiar with the LiveCode environment (also known as the IDE or Integrated Development Environment). We will not go into a detailed explanation of every tool and palette, only of the ones that you will use right away. then as we do harder projects, we will show you the tool at that time.
For a quick preview/overview of creating a program in LiveCode look at the following lesson - Lesson1_Intro_To_LiveCode (Screenshots - "borrowed" from RunRev which made it)
The Palettes and Tools When you open up LiveCode, you see 2 palettes and a reference screen. Feel free to try anything that you see, you can not do much harm. Instead, you are encouraged to look around, experiment and yes, make mistakes. We learn by making mistakes. It teaches us what not to do but it also opens us up to new ideas and techniques. We discover new things to do and use. Here are the palettes and tools with tags that you will be using: LiveCode_Palettes (screenshots). There is an Edit Bar where you will be using quite a bit. Of interest are the "Inspector" and the "Code" icons. These are the 2 main ones that you will be using. The "Inspector" (short for Properties Inspector) brings up all the properties for any object. The "Code" icon brings up the code associated with any object in LiveCode.
The Tools Palette" has all the tools that you will use for creating the different objects in LiveCode. The 2 MOST IMPORTANT ones are the 2 at the top of the "Tools Palette" - The "Run Mode" and "Edit Mode" icons. These allow you to switch between running your code and editing it. LiveCode is designed around objects. Every object has properties and behavior. The properties are all contained in the "Properties Inspector" or "Inspector" for short. Things like color, position, size, visibility are all some of the properties an object can have. You can change them in the "Inspector". But what is so powerful about LiveCode is that you can also change those properties with code. The "Code" palette is where you put the code (or script) for an object. This is the 'behavior' part of the object. Not only can an object respond to events (like the press of a mouse button) but it can also move, change color, disappear (visible is false) and change any of it's other properties.
note: on the top Edit Bar are great resources to help you learn more of LiveCode. I would recommend the following in the order presented:
- User Manual - download for free in the Resource Center (click on the "Resources" icon)
- Dictionary - for looking up the commands and their options (click on "Dictionary")
- Tutorials - really great screen-by-screen help from RunRev (click on "Tutorials" icon)
- User Samples - programs by other users (click on "User Samples" icon)
Objects, Messages and Events In LiveCode, like life, something is always happening. We call them events. In the world of computers, we move the cursor, click on a mouse button or press a keyboard key. These are all called 'events'. With most games, there is always something going on. There are enemies flying around, scenery is changing, a timer is going, the scoring is changing, and you are most likely moving too. All of these 'events' are continuously occurring. Sometimes, something happens as a result - you run into an object, 2 objects collide, time runs out, fuel runs out, you are hit.... When those events happen, something results - the game stops, something explodes, you get more points. All of this is done with code. When an event occurs, a message is sent out - "the mouse button was pressed down", the up-arrow key was pressed", "the cursor was moved". We, as programmers write code to handle those messages and do something. The code we write is referred to as a "message handler" We refer to objects by their 'type' and their 'name' To understand objects, read Objects in LiveCode (doc) That's it. You are now ready to start writing your own programs.
Starting a Program in LiveCode We are now going to see how to get started writing a program in LiveCode. Open up LiveCode. We need to create a new Mainstack.
Oops, what is a Mainstack? The Mainstack is your "Main" "Stack" of cards (or screens) that makes up your program LiveCode works with objects called "Cards". Think of a card as a screen on your computer. We do most of our work putting objects (and code on those objects) on that card (or screen). But a well written program may have many cards (or many screens). There is usually an "Splash Screen" (or Intro or Start screen) with your game title, your name, company and email address. Then there is often a screen with instructions. Then there are usually more than one game screen (Most games have many levels or play - each one is a new screen) . We group those cards into a "Stack". So you always start with a "Mainstack". You can have other stacks for other things but we will start simple for now and only use one stack which starts out with one card
Good Luck and try to have fun
1. Saving Programs You should get in the habit of naming your stacks and saving the programs as soon as you start. Otherwise, every program that you create will be called "Untitled". It gets very confusing trying to figure out where a program is when every file is called "Untitled 1", "Untitled 2", "Untitled 3". SAVE THEM right away when you start.
2. Naming Stacks Just like you name objects and cards, you should also name your stack. You can have more than 1 stack open and it gets confusing figuring out which one to use. NAME THEM
|
 Updating...
Ċ cyril.pruszko@pgcps.org, Dec 14, 2012, 7:15 PM
Ċ cyril.pruszko@pgcps.org, Dec 9, 2012, 3:04 AM
Ċ cyril.pruszko@pgcps.org, Dec 9, 2012, 3:09 AM
|