Noţiuni de bază

Forumul Codea

Apasă aici pentru a accesa forumul Codea. Vorbeşte cu alţi utilizatori, pune întrebări şi impărtăşeşte coduri.

Codea Wiki

Apasă aici pentru a accesa Wiki-ul Codea. Gaseşte tutoriale, ajutor şi alte informaţii preţioase create de alţi utilizatori Codea.

Manual Lua

Apasă aici pentru a accesa Manualul de referinţă Lua, care descrie sintaxa şi semantica Lua şi librăriilor standard.

Elemente de bază pentru Proiect

Ştergere Proiecte

Apasă şi ţine apăsat pe un proiect pentru a-l şterge sau pentru a-l duplica.

Bazele Editorului

Crearea de fişiere noi

Apăsaţi pe butonul plus din colţul drept al tab-ului pentru a crea un fişier şablon sau o clasă nouă necompletată.

Ştergerea şi redenumirea fişierelor

Apăsaţi şi ţineţi apăsat pe un tab pentru a-l redenumi sau pentru a-l şterge.

Caracteristicile editorului

Keyboard Pop-up Keys

Any key on the keyboard containing a circle in the upper-right corner can be long-pressed. You can then drag your finger to choose from alternate symbols and functions.

Color Picker

Any function that can use a color will display a highlight. Tapping the highlight will present a color picker you can use to select a color.

Asset Picker

When using the sprite(), music(), sound() and shader() functions you will see a highlight surrounding the parameters. Tap this highlight to bring up a visual asset picker for selecting graphics, music and more.

Caret Selection Circle

As you are typing, you will notice a small circle appear around the caret in the code editor. You can drag this circle at any time to immediately make a selection.

Search and Replace

Tap the search key to search your code and perform replacements.

Reference Documentation

Tap the reference key to browse the integrated Codea reference documentation at any time.

Play

Tap the play key to run your code.

Tab and Autocomplete

As you type, Codea will present possible word completions above the keyboard. You can tap a particular suggestion, or tap the tab key to autocomplete using the first suggestion.

Math Palette

Tap the math key to get a list of commonly used math, logic and expression symbols. You can also touch-and-drag the math key to quickly select a symbol.

Plus-Equals

A common trait found in simulations and games is incrementing values over time. In most programming languages this is performed with a += operator. That is, a += b is shorthand for a = a + b. Lua does not provide this operator, however you can use the key to expand the currently typed symbol as follows:

a

pressed

a = a +

This can be a timesaver when dealing with long variable names, such as self.position

Caret Positioning

Touch and drag to shift the text caret around your code. You can also tap the left or right edge of the key to shift the caret by one character.

Touch and drag to drag out a selection in your code.

Parentheses, Quoting and Indenting

The keys will create an enclosing pair of parentheses or quote marks with the insertion caret placed between them.

If you select some text you will see them change as follows

This indicates that pressing the parentheses or quote key will enclose the currently selected text in quotes or parentheses. Note that similar functionality is present with the square brackets and curly braces in the math palette

When a block of text is selected, the Tab key will change to Pressing it in this state will indent the entire block. You can also long-press the tab key to backwards-indent a selected block of text.

Bluetooth Keyboard Shortcuts

When using a bluetooth keyboard the following shortcuts are available.

⌘R Run Project

⌘F Search Project

⌘D Show Documentation

⌘W Close Project

⌘N New Class

⌘B New Blank File

⌘/ or ⌘- Comment Line

⌘[ or ⌘O Indent Code

⌘] or ⌘I Backwards Indent Code

⌘⇧[ or ⌘⇧O Previous Tab

⌘⇧] or ⌘⇧I Next Tab

Codea Basics

Codea Global Functions

By default your new projects will contain two functions: setup() and draw(). These will be called automatically by Codea in order to setup and draw your project. However there are a number of other functions you can implement to receive information when changes happen.

function touched( touch )

Implement this function to receive events whenever a touch on the screen begins, ends, or moves. You can use this function to receive multi-touch information and respond to complex user interaction.

function keyboard( key )

When the keyboard is shown using showKeyboard(), this function will be called when a key is pressed.

function collide( contact )

Implement this function if you are using the Physics API and wish to receive a notification any time two bodies collide with each other in your simulation.

function orientationChanged( newOrientation )

Implement this function to receive notification when the screen orientation changes, usually due to the device being rotated by the user. You may wish to use this function to re-layout your scene for the new orientation.