Now that you know how to move your player, lets add some more objects (obstacles, enemies and prizes)
1. Types of Objects - Images - photographs, pictures, etc (jpg, bmp, etc) - bitmapped and can be edited
- Graphics - geometric shapes (squares, circles, lines - resizeable
- Buttons ** - the basic object to be manipulated in LiveCode
** - Best choice for players and moveable objects in LiveCode. They can be "skinned" with images to look real.
You have choices here on what objects to add. (If you haven't read about Objects in LiveCode, read it now) You can add Images (bmp, gif, jpg, png, etc), Graphics rectangles, squares, circles, ovals, etc), buttons (from the Tool Palette and others)
If you use images from the Internet, make sure that they are free and you have the owner's permission to use it. (Copyrights should be honored and require the owner's permission to use them).
You can now add prizes (diamonds, points, etc), enemies (bombs, black holes, etc) barriers (walls, rocks, etc) or any other number of objects that will add fun and excitement to your game What You Can Do With Objects Objects have many properties that you can set in the Property Inspector or in your code. For instance you can easily:
- make an object appear or disappear
- become inactive
- change color
- move on its own
- change shape or image
- grow or shrink
- interact with your player
1. Adding Images Use the image object type to hold photographs, icons, and decorative elements, and to allow the user to paint. Each image contains a bitmapped picture, which can either be imported with the import command or created using the paint tools. To add an image to your card, click on "File", "Import as Control" and "Image File..." from the main Tool Bar
And you can edit them with the Image (bit-mapped) tools from the Tools Palette to remove white spaces, add more detail, change colors, etc.
You can use the images as their own objects in the code and it works well. But if you are going to be moving them around, using them as active parts of your game, you probably should use them as "skins" for buttons which are more manuverable and easier to work with.
2. Drawing Your Own Graphics Use the graphic object type to create a geometric shape, a straight or broken line, an arrow, or other shape. Graphics can be circles, ovals, arcs, squares, rectangles, regular polygons with any number of sides, irregular polygons (closed or open), lines (jagged or straight), or curves (smooth or broken). Unlike an image, a graphic can be resized without losing detail or becoming "jagged".
Use these graphic tools from the Tool Palette
These can be obstacles, objects, boundaries or any other useful object.
3. Using Buttons ** - Best choice for objects If your object is not just scenery, you may want to use a "button" from the Tool Palette and "skin" it with a image. Buttons work better and are more flexible in games. They are faster and easier to move, detect collisions, change their looks and so much more. Use them if you can.
That is why we start out with our button "box". It is very easy to "skin" it with a image of a rabbit - to make a rabbit game, or to skin it with a rocket to make a space game. The code stays the same because we are moving the box (not the image). So you can change skins on the fly and have a really exciting game. Use buttons.
NEXT Lesson - Detecting Collisions |
 Updating...
Ċ cyril.pruszko@pgcps.org, Jan 5, 2013, 1:12 PM
|