Академический Документы
Профессиональный Документы
Культура Документы
Maker
1.3.0 e 2.0.0
Português
Manual
Traduzido por Bruno Silva
www.arcadotululoo.blogspot.
pt
Este manuel foi escrito em Setembro 2013
Créditos
Este manual é escrito por Bruno Silva.
www.arcadotululoo.blogspot.
pt
www.tululoo.com
Tululoo
Tululoo Game Maker é um ambiente de criação do jogo complexos que permite criar
jogos baseados no navegador. O programa gera um código Javascript que pode ser
jogado em navegadores web usando o HTML5.
Com Tululoo você pode criar jogos para seus dispositivos móveis, como os mais
recentes já suportam os novos padrões HTML5. Tululoo vem com um usuário simpática
gerente de recursos e editor de script, onde você pode importar suas imagens,
backgrounds, sprites animados, sons. Você pode facilmente criar os objetos (atores
como jogador, os inimigos, itens colecionáveis, etc) e você também pode adicionar suas
próprias funções e scripts para os objetos do jogo.
3.1 Básico
Todas as linha de código devem acabar com ( ; )
move;
Funções são usadas na grande parte do tempo no Tululoo e devem ser postas assim
Função(parâmetro);
Array são uteis para fazer HUD e mochilas de itens elas se escrevem assim
array = [];
____________________________________________________________________________
//Desenha HUD
draw_set_font(font do text);
draw_text(x,y,"Vida " + var_vida);
if ( keyboard_check( vk_a )) {
move_towards_point(x - 5,y,280);
}
if ( keyboard_check( vk_w )) {
move_towards_point(x,y - 5,280);
}
if ( keyboard_check( vk_s )) {
move_towards_point(x,y + 5,280);
}
3.2 Cálculos
Como você deve saber, os jogos em HTML5 pode ser jogado em dispositivos móveis
(se o navegador usar HTML5). Esses jogos também pode ser criado com Tululoo.
Quando no dispositivo móvel, a posição do mouse e estado é atualizado
automaticamente - posição do cursor é calculado como uma média entre todos os
pontos que tocou.
Para criar teclas ou seja botões virtuais na tela, a seguinte rotina existe:
vkey_add(x, y, width, height, index) -adiciona uma tecla virtual com os parâmetros
especificados. Índice de parâmetro indica o índice da tecla a ser simulado quando a tecla
virtual é pressionada (ou seja VK_ENTER)
A função retorna um objeto virtual, que tem os seguintes parâmetros:
left - teclas virtuais min X
top - teclas virtuais min Y
right - teclas virtuais max X
bottom - teclas virtuais max Y
key - índice da tecla, ligado à tecla virtual
active - indica se a tecla virtual é ativa, portanto, pode ser pressionado
3.5 Instâncias
3.6 Desenho/Drawing
draw_line(x1, y1, x2, y2) - desenha uma linha entre as coordenadas especificadas
draw_rectangle(x1, y1, x2, y2) - desenha um retângulo entre as coordenadas
especificadas (superior esquerdo - canto inferior direito)
draw_circle(x, y, radius, outline) - desenha um círculo em coordenadas especificadas
com raio escolhido. 'outline' Parâmetro indica se deve ser preenchido (0) ou não (1).
draw_sprite(sprite, frame, x, y) - chama a moldura escolhida de sprite especificado em
determinadas coordenadas.
draw_sprite_ext(sprite, frame, x, y, xscale, yscale, direction, alpha) - chama a sprite
especificado com determinados parâmetros de dimensionamento, rotação e alfa em
determinadas coordenadas.
As seguintes funções afeta as configurações utilizados por funções acima:
draw_set_color(r, g, b) - muda de cor o desejado texto, sprite e outros (0 .. 255)
draw_set_alpha(alpha) - altera a transparência para as operações de desenho subseqüentes (0 ..
1)
draw_set_linewidth(width) - altera a largura das linhas para operações de desenho.
3.7 Texto
bold - bold
italic - italico
size - tamanho
family -tipo de letra ("Arial", "Sans", etc.)
3.8 Sprites
Os Objetos pode ser referenciado através do seu nome, desenhado, e designado como
sprite_index às instâncias.
Eles têm os seguintes campos:
collision_left - indica min. x limites de colisão.
collision_top - indica min. y dos limites de colisão.
collision_right - indica max. x limites de colisão.
collision_bottom - Indica max. y dos limites de colisão.
collision_shape - indica colisão tipo do sprite ("Box" ou "Circle") Na versão 2.0.0 foi adicionado
"Shape"
height - indicates sprite height
width - indica a largura do sprite
xoffset - indica Sprite x deslocamento (origem)
yoffset - indica duende y deslocamento (origem).
Se está recomenda uma extenção de som pois o tululoo é muito imcompleto em termos de
som:
é feito por Arkanis
[EXTENSION]
Music
[AUTHOR]
Ivan Hayward - AC Arcana
[DESCRIPTION]
This extension is meant to
facilitate easier control of music
elements in games.
[HELP]
music_prepare(track) - Sets a track to play
music_play() - Plays a track if one is already set
music_play(track) - Starts the passed sound
music_pause() - Pauses the current track
music_is_paused() - Returns true of the track is paused, false if it is playing, and null if no track
is set
music_toggle_pause() - Toggles whether the current track is paused
music_resume() - Resumes a paused track
music_stop() - Stops the track if it is playing and resets its time to 0
music_stop_and_clear() - Stops the track and clears the current track
music_is_playing() - Return true if the track is playing, false if not, null if no track is set
music_loop(track) - Starts the passed sound looping
music_loop(boolean) - Sets looping to the passed value when passed a boolean
music_loop() - Sets the current track to loop
music_unloop() - Sets the current track to stop looping
music_toggle_loop() - Toggles the loop state of a track
music_is_loop() - Returns true if music is looped, false if not, and null if no track is set
music_volume(volume) - Sets the volume of the current track ( 0 = silent, 100 = full volume )
music_get_volume() - Returns the current volume of the track, or null if no track is set
music_increase_volume() - Increases volume by 1
music_increase_volume(volume) - Increases volume by the passed amount
music_decrease_volume() - Decreases volume by 1
music_decrease_volume(volume) - Decreases volume by the passed amount
music_mute(boolean) - Sets whether the current track is muted
music_mute() - Mutes the current track
music_unmute() - Unmutes the current track
music_toggle_mute() - Toggles the current mute state
music_is_muted() - Returns true if the music is muted, false if it is not, and null if no track is set
music_current_time(time) - Sets the current time for the track in seconds
music_get_current_time() - Returns the current time for the track, or null if no track is set
music_percent(percent) - Sets the current position of the track to the passed percentage
music_get_percent(percent) - Returns the current time's percentage of the track duration
music_get_duration() - Returns the duration of the track or null if no track is set
music_playback_rate(rate) - Sets the current track's playback rate
music_get_playback_rate() - Returns the current track's playback rate, or null if no track is set
music_is_ended() - Returns true of the music has ended, false if not, and null if no track is set
music_get_played() - Returns a TimeRanges object representing the played parts of the audio, or
null if no track is set
music_get() - Returns the currently set track or null if no track set
music_get_error() - Returns any recorded errors for the track or null if no track set
music_fade_in(duration) - Fades a track in to full volume over the passed duration in
milliseconds
music_fade_in(duration, volume) - Fades a track in to the passed volume over the passed duration
in milliseconds
music_fade_in(duration, volume, callback) - Fades a track in to the passed volume over the
passed duration in milliseconds, and calls the function passed in callback when done
music_fade_out(duration) - Fades a track out to silence over the passed duration in milliseconds
music_fade_out(duration, volume) - Fades a track out to passed volume over the passed duration
in milliseconds
music_fade_out(duration, volume, callback) - Fades a track out to passed volume over the passed
duration in milliseconds, and calls the function passed in callback when done
music_fade_to(duration, volume) - Fades the track in or out to the passed volume over the passed
duration
music_fade_to(duration, volume, callback) - Fades the track in or out to the passed volume over
the passed duration, and calls the function passed in callback when done
music_fade_with(track, duration, crossfade) - Fades the current track out and the pased track in
over the passed duration. The passed track will become the currently set track. If crossfade is true
they will fade at the same time, otherwise they will fade individually
music_fade_with(track, duration, crossfade, volume) - Fades the current track out and the pased
track in to the passed volume over the passed duration. The passed track will become the
currently set track. If crossfade is true they will fade at the same time, otherwise they will fade
individually
music_fade_with(track, duration, crossfade, volume, callback1, callback2) - Fades the current
track out and the pased track in to the passed volume over the passed duration. The passed track
will become the currently set track. If crossfade is true they will fade at the same time, otherwise
they will fade individually, when the first track fades out callback1 is called, when the second
track fades in callback2 is called
music_bind_event(event, callback) - Binds a standard music event to the function passed
Standard music events: abort, canplay, canplaythrough, durationchange, emptied, ended, error,
loadeddata, loadedmetadata, loadstart, pause, play, playing, progress, ratechange, seeked,
seeking, stalled, suspend, timeupdate, volumechange, waiting
music_unbind_event(event, callback) - Unbinds the chosen event and passed function
[CODE]
function music_loop(track) {
if(track === undefined){
if(typeof window.music !== "undefined")
window.music.loop = true;
}
else if(typeof track === "boolean") {
if(typeof window.music !== "undefined")
window.music.loop = track;
}
else {
window.music = track.audio;
window.music.loop = true;
window.music.play();
}
}
function music_play(track) {
if(track === undefined) {
if(typeof window.music !== "undefined")
window.music.play();
}
else {
window.music = track.audio;
window.music.play();
}
}
function music_is_playing() {
if(typeof window.music !== "undefined") {
if(window.music.currentTime == 0)
return false;
else if(window.music.paused)
return false;
else
return true;
}
return null;
}
function music_prepare(track) {
window.music = track.audio;
}
function music_stop() {
if(typeof window.music !== "undefined") {
window.music.pause();
window.music.currentTime = 0;
}
}
function music_stop_and_clear() {
if(typeof window.music !== "undefined") {
window.music.pause();
window.music = undefined;
}
}
function music_unloop() {
if(typeof window.music !== "undefined")
window.music.loop = false;
}
function music_toggle_loop() {
if(typeof window.music !== "undefined")
window.music.loop = !window.music.loop;
}
function music_is_looped() {
if(typeof window.music !== "undefined")
return window.music.loop;
else
return null;
}
function music_pause() {
if(typeof window.music !== "undefined")
window.music.pause();
}
function music_is_paused() {
if(typeof window.music !== "undefined")
return window.music.paused;
else
return null;
}
function music_toggle_pause() {
if(typeof window.music !== "undefined") {
if(window.music.paused)
window.music.play();
else
window.music.pause();
}
}
function music_resume() {
if(typeof window.music !== "undefined")
window.music.play();
}
function music_mute(boolean) {
if(typeof window.music !== "undefined") {
if(boolean === undefined)
window.music.muted = true;
else
window.music.muted = boolean;
}
}
function music_unmute() {
if(typeof window.music !== "undefined")
window.music.muted = false;
}
function music_toggle_mute() {
if(typeof window.music !== "undefined")
window.music.muted = !window.music.muted;
}
function music_is_muted() {
if(typeof window.music !== "undefined")
return window.music.muted;
return null;
}
function music_time(time) {
if(typeof window.music !== "undefined")
window.music.currentTime = time;
}
function music_get_time() {
if(typeof window.music !== "undefined")
return window.music.currentTime;
return null;
}
function music_get_duration() {
if(typeof window.music !== "undefined")
return window.music.duration;
return null;
}
function music_playback_rate(rate) {
if(typeof window.music !== "undefined")
window.music.playbackRate = rate;
}
function music_get_playback_rate() {
if(typeof window.music !== "undefined")
return window.music.playbackRate;
else
return null;
}
function music_is_ended() {
if(typeof window.music !== "undefined")
return window.music.ended;
}
function music_get_played() {
if(typeof window.music !== "undefined")
return window.music.played;
else
return null;
}
function music_volume(volume) {
if(typeof window.music !== "undefined")
window.music.volume = volume / 100;
}
function music_get_volume() {
if(typeof window.music !== "undefined")
return Math.round(window.music.volume * 100);
else
return null;
}
function music_increase_volume(volume) {
if(typeof window.music !== "undefined") {
if(volume === undefined) {
if(window.music.volume <= 0.99)
window.music.volume += 0.01;
else
window.music.volume = 1;
}
else {
if(window.music.volume + (volume / 100) <= 1)
window.music.volume += (volume / 100);
else
window.music.volume = 1;
}
}
}
function music_decrease_volume(volume) {
if(typeof window.music !== "undefined") {
if(volume === undefined) {
if(window.music.volume >= 0.01)
window.music.volume -= 0.01;
else
window.music.volume = 0;
}
else {
if(window.music.volume - (volume / 100) >= 0)
window.music.volume -= (volume / 100);
else
window.music.volume = 0;
}
}
}
function music_get() {
if(typeof window.music !== "undefined")
return window.music;
else
return null;
}
function music_get_error() {
if(typeof window.music !== "undefined")
return window.music.error;
else
return null;
}
function music_fade_in(duration, volume, callback) {
if(volume === undefined)
volume = 1;
else
volume = volume / 100;
if(typeof window.music !== "undefined") {
if(window.music.paused)
window.music.play();
var interval = setInterval(function() {
if (window.music.volume + 0.05 <= volume)
window.music.volume += 0.05;
else {
window.music.volume = volume;
if(callback !== undefined)
callback();
clearInterval(interval);
}
}, duration / ((volume - window.music.volume) / 0.05));
}
}
function music_fade_out(duration, volume, callback) {
if(volume === undefined)
volume = 0;
else
volume = volume / 100;
if(typeof window.music !== "undefined") {
if(window.music.paused)
window.music.play();
var interval = setInterval(function() {
if (window.music.volume - 0.05 > volume)
window.music.volume -= 0.05;
else {
window.music.volume = volume;
if(callback !== undefined)
callback();
clearInterval(interval);
}
}, duration / ((window.music.volume - volume) / 0.05));
}
}
function music_fade_to(duration, volume, callback) {
volume = volume / 100;
if(typeof window.music !== "undefined") {
if(window.music.paused)
window.music.play();
if(window.music.volume > volume) {
var interval = setInterval(function() {
if (window.music.volume - 0.05 > volume)
window.music.volume -= 0.05;
else {
window.music.volume = volume;
if(callback !== undefined)
callback();
clearInterval(interval);
}
}, duration / ((window.music.volume - volume) / 0.05));
}
else if(window.music.volume < volume) {
var interval = setInterval(function() {
if (window.music.volume + 0.05 < volume)
window.music.volume += 0.05;
else {
window.music.volume = volume;
if(callback !== undefined)
callback();
clearInterval(interval);
}
}, duration / ((volume - window.music.volume) / 0.05));
}
}
}
function music_fade_with(track, duration, crossfade, volume, callback1, callback2) {
if(volume === undefined)
volume = 1;
else
volume = volume / 100;
if(typeof window.music !== "undefined") {
if(crossfade) {
if(window.music.paused)
window.music.play();
track.audio.volume = 0;
track.audio.play();
var interval = setInterval(function() {
if (window.music.volume - 0.05 > 0)
window.music.volume -= 0.05;
else {
window.music.volume = 0;
if(callback1 !== undefined)
callback1();
}
if(track.audio.volume + 0.05 < volume)
track.audio.volume += 0.05;
else
track.audio.volume = volume;
if(window.music.volume == 0 && track.audio.volume == volume)
{
window.music.volume = 0;
track.audio.volume = volume;
window.music = track.audio;
if(callback2 !== undefined)
callback2();
clearInterval(interval);
}
}, duration / (window.music.volume / 0.05));
}
else {
if(window.music.paused)
window.music.play();
track.audio.volume = 0;
var interval = setInterval(function() {
if (window.music.volume - 0.05 > 0)
window.music.volume -= 0.05;
else if(track.audio.paused || track.audio.currentTime == 0)
track.audio.play();
else if(track.audio.volume + 0.05 < volume)
track.audio.volume += 0.05;
else {
track.audio.volume = volume;
window.music = track.audio;
clearInterval(interval);
}
}, duration / ((window.music.volume + volume) / 0.05));
}
}
}
function music_bind_event(event, callback) {
if(typeof window.music !== "undefined") {
window.music.addEventListener(event, callback);
}
}
function music_unbind_event(event, callback) {
if(typeof window.music !== "undefined") {
window.music.removeEventListener(event, callback);
}
}
function music_percent(percent) {
if(typeof window.music !== "undefined")
window.music.currentTime = (percent / 100) * window.music.duration;
}
function music_get_percent() {
if(typeof window.music !== "undefined")
return (window.music.currentTime / window.music.duration) * 100;
else
return null;
}
3.10 Room/Cenas
3.11 Tiles/tilesets
tile_add(background, left, top, width, height, x, y, depth) - adiciona uma novo tile e
retorna objeto tile (veja abaixo).
tile_delete(tile) - remove tile da cena
tile_find(x, y, width, height, depth) - retorna um array, contendo todas as peças que
cruzam a região especificada.
Objeto tile tem as seguintes propriedades:
source - fundo, a partir do qual imagem o tile é tomado.
x - x posição no palco.
y - y posição no palco.
left - posição x de parte para exibir (no fundo).
top - posição x de parte para exibir (no fundo).
width - largura da parte para exibir (no fundo).
height - altura da parte para exibir (no fundo).
width2 - 'on-screen " largura do tile. Tendo esta diferente de propriedade de largura, vai
esticar o tile.
height2 - 'on-screen' altura do tile. Tendo esta diferente da propriedade altura vai esticar o
tile
Muito útil para criar saves e tabelas de pontos online, todo gravado num servidor depois.
Armazenamento web local pode ser usado para armazenar informações entre o jogo\sessões do
programa.
load_web_data(key) - cargas e retorna uma variável de armazenamento local
load_web_integer(key) - cargas e retorna um inteiro de armazenamento local
load_web_float(key) - cargas e retorna um valor de ponto flutuante de armazenamento
local
load_web_string(key) - cargas e retorna uma string de armazenamento local
Existem as seguintes rotinas para gravar informações para o armazenamento local:
save_web_data(key, value) - salva uma variável para armazenamento local.
save_web_integer(key, value) - salva um integer para armazenamento local.
save_web_float(key, value) - salva o valor de ponto flutuante para armazenamento
local.
save_web_string(key, value) - salva um string em armazenamento local.
Existem as seguintes rotinas para remover a informação existente do armazenamento local:
delete_web_data(key) - remove variável de armazenamento local.
delete_web_integer(key) - remove integer de armazenamento local.
delete_web_float(key) - remove o valor de ponto flutuante de armazenamento local.
delete_web_string(key) - remove o string do armazenamento local.
Existem as seguintes rotinas para a realização de outras operações com armazenamento local:
web_data_number() - retorna o número total de campos guardados no armazenamento
local.
clear_web_data() - apaga todos os dados do armazenamento local.
3.13 Sistema
Além de variáveis e funções que podem ser encontrados em tópicos
acima, Tululoo contém um quadro da sua própria, que também tem as
suas próprias variáveis e funções. Estes não podem ser necessários para o
uso 'cotidiano', e estão documentadas aqui principalmente para
extensões.
var_override(object, property, getfunction, setfunction) - especificada variável 'overrides'
para o objeto, adicionando uma função setter e getter. Estes podem ser ambas as referências, ou
funções inline. Exemplo de uso:
var_override(this, 'rdirection',
function() { return tu_d2r * this.direction; },
function(value) { this.direction = value * tu_r2d; });
Math:
tu_2pi - contém o valor de 2 Math.PI (círculo completo em radianos).
tu_r2d - multiplicar um ângulo radiano por esta constante para convertê-lo em graus.
tu_d2r - multiplicar um ângulo por esta constante para convertê-lo em radianos.
tu_elapsed - indica o tempo (em ms) passou de ciclo jogo anterior.
Resources:
tu_idle - "boneco" (vazio) função, que pode ser utilizado como valor padrão para
variáveis de função.
tu_sprites - array, que contém todos os recursos do sprite do jogo.
tu_backgrounds - array, que contém todos os recursos do fundo do jogo.
tu_fonts - array, que contém todas as fonts do jogo.
tu_scenes - array, que contém todos as salas do jogo.
tu_audios - array, que contém toda a trilha sonora do jogo.
Instances:
tu_depth, tu_depthi - arrays, contendo a lista de instâncias classificadas por valor de
profundidade. Para obter instâncias em certa profundidade, use
tu_depth[tu_depthi.indexOf(depth)]
tu_types - array, contendo listas de instâncias por sua herança objeto. Use tu_types
[object_index] para obter todas as instâncias que são (ou são filhos de) casos de tipo
especificado.
Drawing:
tu_canvas - contém um ponteiro para HTML5 canvas, que Tululoo usa para o desenho.
tu_context - contém um apontador para "contexto" do tu_canvas.
Sound & Music: tu_wav_supported - indica se os sons WAV são suportados pelo
browser.
tu_ogg_supported - indica se os sons OGG são suportados pelo browser.
tu_mp3_supported - indica se os sons MP3 são suportados pelo browser.