..:: MX Studio Fóruns ::..: Como calcular força num jogo de sinuca - AS3 - ..:: MX Studio Fóruns ::..

Jump to content

Publicidade




Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Como calcular força num jogo de sinuca - AS3

#1 User is offline   Vitor Wdson 

  • Group: Membros
  • Posts: 1
  • Joined: 12-March 12

Posted 13 March 2012 - 01:24 AM

Gente to fazendo um jogo de sinuca mas quando eu vou calcular a força da:
ex:
max = 150
min = 140

só tem 10 de diferença como q eu faço.
to fazendo assim:
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.events.MouseEvent;
import fl.transitions.Tween;
import fl.transitions.easing.None;
import flash.geom.Rectangle;

var power:int = 0;
var distancia:int = 0;

// Mecher Taco
var verif:Timer = new Timer(0,1);
var volta:Tween;
var area:int = 225 - 175;

verif.addEventListener(TimerEvent.TIMER, verifica);
stage.addEventListener(MouseEvent.MOUSE_DOWN, clica);


function clica(e:MouseEvent):void {
	stage.removeEventListener(MouseEvent.MOUSE_DOWN, clica);
	stage.addEventListener(MouseEvent.MOUSE_MOVE, meche);
	stage.addEventListener(MouseEvent.MOUSE_UP, solta);
}

function verifica(e:TimerEvent):void {
	taco_linha.taco.startDrag(false, new Rectangle(-225, 0 , 75,0));

}

function meche(e:MouseEvent):void {
	stage.addEventListener(MouseEvent.MOUSE_UP, solta);
	verif.start();
	
}

function solta(e:MouseEvent):void {
	stage.removeEventListener(MouseEvent.MOUSE_MOVE, meche);
	stage.removeEventListener(MouseEvent.MOUSE_UP, solta);
	stage.addEventListener(MouseEvent.MOUSE_DOWN, clica);
	verif.stop();
        // calculando força
	power = area - ( area - (taco_linha.taco.x / 3) );
	taco_linha.taco.stopDrag();
	volta = new Tween(taco_linha.taco, "x", None.easeNone, 0, -175, 1, true);
	taco_linha.taco.x = 175,20;
}

// Colisão
var colisao:Boolean = false;
var testColi:Timer = new Timer(1);
var anima:Tween;

testColi.addEventListener(TimerEvent.TIMER, testeColisao);

testColi.start();

function testeColisao(e:TimerEvent):void {
	if (taco_linha.taco.hitTestObject(branca)){
		distancia = power;
		colisao = true;
	}
	if (colisao == true) {
		trace ( distancia);
		anima = new Tween(branca, "x", None.easeOut, branca.x, (taco_linha.linha.x + distancia), 12, false);
		colisao = false;
	}
}


pf onde estou errando, me ajudem ja tentei de tudo mas n da

OBS: ja tentei colocar pra q cada pos~ção tenha uma força determinada mas da erro.

Obrigado desde já.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic


Similar Topics Collapse

  Topic Forum Started By Stats Last Post Info
New Replies Borda.
Como faço???
Fireworks Apenas_Iniciante 
  • 9 Replies
  • 1070 Views
New Replies usando mail() para responder á um e-mail específico
como em mensagens automáticas do Orkut
PHP marcel crispim 
  • 7 Replies
  • 1474 Views
New Replies como fazer download de arquivo
duvida de como fazer download de arquivo
Flash & ActionScript fran6 
  • 2 Replies
  • 722 Views
New Replies Comoativar o cadeado no IE 6.0 Plataforma Windows ferazia 
  • 2 Replies
  • 1855 Views
New Replies Daltonismo
Como lidar?
Publicidade e Propaganda Murilo 
  • 3 Replies
  • 1186 Views
New Replies COMO COMPARAR SE É UM VALOR NUMERICO EM ASP
VALOR NUMÉRICO EM ASP
ASP rogardin 
  • 1 Reply
  • 1696 Views
New Replies Parte de um Motion tween
Flash como se faz?
Flash & ActionScript sluyz 
  • 1 Reply
  • 1097 Views
New Replies chamar uma index html
como faço isso.
Flash & ActionScript Only Dust 
  • 2 Replies
  • 798 Views

Publicidade




1 User(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)