Ir para conteúdo
  • Cadastre-se

Criando um jogo de tiro pequeno


jrboot

Posts recomendados

tiro01.jpg

 

 

Neste tutorial, você aprenderá a criar um tiroteio "pequenas estrelas" do jogo usando o Flash e ActionScript 3. Vamos começar!

 

1. Abra um novo documento Flash e salve-o em "ShootingGame.fla". Defina o tamanho de 500 x 300 pixels.

 

 

2. Primeiro de tudo é preciso tirar os olhos de nossa arma. Então, renomeie a primeira camada de "vista". Pegue a ferramenta Oval e no painel de propriedades defina suas propriedades de sólidos, Preenchimento com mobilidade condicionada, altura do curso deve ser ajustado para 3.

Então pegue a ferramenta Seleção, selecione uma parte do círculo e corte-o assim:

 

 

tiro02.jpg

 

 

O passo final é levar a ferramenta Line e desenhe uma cruz. Basta alterar o valor da altura de 1,5 curso. Selecione a visão completa e convertê-lo em Movie Clip com o exemplo "visão nome" e ponto central do registo.

 

 

3. Agora, a nossa visão está pronto e precisamos desenhar uma estrela. Pegue a ferramenta Polystar e defini-lo de imóveis como este:

 

 

tiro03.jpg

 

 

Se a sua estrela está pronto, selecione-o e convertê-lo em Movie Clip com o ponto central do registo. Linkage a estrela classe Star, indo para o painel Library (Ctrl + L), botão direito do mouse no clipe de filme Star e, em seguida, definir o nome da classe . Remover a estrela do palco.

 

shotting4.jpg

 

 

4. Pegue a ferramenta de texto e de criar primeiro um campo de texto estático e escreva "Pontuação". Em seguida, crie um campo de texto dinâmico com nome de instância "points_txt" e posicioná-lo próximo ao campo de texto estático. Incorporar os valores numéricos para a fonte e escolher a cor # FF0000. Alinhar os campos de texto para a parte inferior direita do palco.

 

 

 

 

5. Crie uma nova camada chamada "ações", abra Painel de Ações e digite o seguinte:

 

//importing tween classes

import fl.transitions.easing.*;

import fl.transitions.Tween;

 

//hiding the cursor

Mouse.hide();

 

//creating a new Star instance

var star:Star = new Star();

//creating the timer

var timer:Timer = new Timer(1000);

//we create variables for random X and Y positions

var randomX:Number;

var randomY:Number;

//variable for the alpha tween effect

var tween:Tween;

//we check if a star instance is already added to the stage

var starAdded:Boolean = false;

//we count the points

var points:int = 0;

 

//adding event handler on mouse move

stage.addEventListener(MouseEvent.MOUSE_MOVE, cursorMoveHandler);

//adding event handler to the timer

timer.addEventListener(TimerEvent.TIMER, timerHandler);

//starting the timer

timer.start();

 

function cursorMoveHandler(e:Event):void{

//sight position matches the mouse position

sight.x = mouseX;

sight.y = mouseY;

}

 

function timerHandler(e:TimerEvent):void{

//first we need to remove the star from the stage if already added

if(starAdded){

removeChild(star);

}

 

//positioning the star on a random position

randomX = Math.random()*500;

randomY = Math.random()*300;

star.x = randomX;

star.y = randomY;

//adding the star to the stage

addChild(star);

//changing our boolean value to true

starAdded = true;

//adding a mouse click handler to the star

star.addEventListener(MouseEvent.CLICK, clickHandler);

//animating the star's appearance

tween = new Tween(star, "alpha", Strong.easeOut, 0, 1, 3, true);

}

 

function clickHandler(e:Event):void{

//when we click/shoot a star we increment the points

points ++;

//showing the result in the text field

points_txt.text = points.toString();

}

 

 

 

 

Download:

O conteúdo está oculto, favor efetuar login ou se cadastrar!

 

Fonte:

O conteúdo está oculto, favor efetuar login ou se cadastrar!

.[ Visualização : ]

wixo7.png

Red Materia ,Blue Materia & Green Materia : 9vJK7.jpg Link Tópico : Aqui . Link Meus Conteudos : Aqui

Procuro Staff '

Link para o comentário
Compartilhar em outros sites

  • 3 months later...

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Processando...
  • Registre-se

    Faça parte da maior e  mais antigas comunidades sobre Lineage2 da América Latina.





×
×
  • Criar Novo...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.