Book Image

LiveCode Mobile Development Cookbook

By : Dr. Edward Lavieri
Book Image

LiveCode Mobile Development Cookbook

By: Dr. Edward Lavieri

Overview of this book

Table of Contents (17 chapters)
LiveCode Mobile Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Randomizing numbers


There can be a number of reasons you will want your mobile app to generate random numbers. You might create a slot or another gambling app or simply want enemy robots in a game to come from random vectors. Regardless of your need, LiveCode makes it easy to generate random numbers.

How to do it...

In this recipe, you will create a user interface that allows the user to enter upper and lower limits and then generate a random number within those limits.

  1. Open LiveCode and create a new main stack.

  2. Drag a new label field to the card and set the following properties:

    • Name: fld_Lower

    • foregroundColor: Yellow

    • Width: 158

    • Height: 32

    • Location: 87, 64

    • Font: Courier

    • Text size: 18

    • Text style: Bold

    • Align text center

    • Contents: Set Lower Limit:

  3. Drag a second label field to the card and set the following properties:

    • Name: fld_Upper

    • foregroundColor: Yellow

    • Width: 158

    • Height: 32

    • Location: 259, 64

    • Font: Courier

    • Text size: 18

    • Text style: Bold

    • Align text center

    • Contents: Set Upper Limit:

  4. Drag...