Comunidad de diseño web y desarrollo en internet online

alguien que me ayude con esto?

Citar            
MensajeEscrito el 09 Sep 2008 05:38 pm
Hola

Tengo un problema con un juego que que estoy haciendo con flash cs3. Es un juego de memorama de 36 tarjetas (6x6), cuando paso el cursor del mouse sobre las cartas me muestra el icono de la mano, pero el tarjeta 1 y 6 de la fila 1 el cursor que muestra es que aparece cuando alguien va a seleccionar texto, solamente en esas 2 tarjetas es donde tengo el problema. ¿Alguien sabe a que se debe esto?, ¿Será un bug del mismo flash y actionscript?

Aqui le pongo las imagenes

Esta es la imagen de la tarjeta 1, vease que cuando se pasa el puntero del mouse sobre la tarjeta no muestra el icono de la mano.

[img]http://s376.photobucket.com/albums/oo209/bhelidass/?action=view&current=1.png[/img]

Esta es la imagen de la otra tarjeta, o sea, la tarjeta 6, vease que sucede lo mismo que con la tarjeta 1

[img]http://s376.photobucket.com/albums/oo209/bhelidass/?action=view&current=2.png[/img]

Estas son las imagenes cuando se pasa el puntero del mouse en las demas tarjetas.

[img]http://s376.photobucket.com/albums/oo209/bhelidass/?action=view&current=3.png[/img]

[img]http://s376.photobucket.com/albums/oo209/bhelidass/?action=view&current=4.png[/img]

Aqui les dejo el codigo en actionscript

Este es del juego
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.utils.getTimer;
import flash.utils.Timer;
//import flash.media.Sound;
//import flash.media.SoundChannel;

public class game extends MovieClip {
// game constants
private static const boardWidth:uint = 6;
private static const boardHeight:uint = 6;
private static const cardHorizontalSpacing:Number = 82;
private static const cardVerticalSpacing:Number = 82;
//private static const boardOffsetX:Number = 145;
private static const boardOffsetX:Number = 69;
//private static const boardOffsetY:Number = 70;
private static const boardOffsetY:Number = 74;
private static const pointsForMatch:int = 100;
private static const pointsForMiss:int = -5;

// variables
private var firstCard:carta;
private var secondCard:carta;
private var cardsLeft:uint;
private var gameScore:int;
private var gameStartTime:uint;
private var gameTime:uint;

// text fields
private var gameScoreField:TextField;
private var gameTimeField:TextField;

// timer to return cards to face-down
private var flipBackTimer:Timer;

// set up sounds
/*var theFirstCardSound:FirstCardSound = new FirstCardSound();
var theMissSound:MissSound = new MissSound();
var theMatchSound:MatchSound = new MatchSound();*/

// initialization function
public function game():void {
// make a list of card numbers
var cardlist:Array = new Array();
for(var i:uint=0;i<boardWidth*boardHeight/2;i++) {
cardlist.push(i);
cardlist.push(i);
}

// create all the cards, position them, and assign a randomcard face to each
cardsLeft = 0;
for(var x:uint=0;x<boardWidth;x++) { // horizontal
for(var y:uint=0;y<boardHeight;y++) { // vertical
var c:carta = new carta(); // copy the movie clip
c.stop(); // stop on first frame
c.x = x*cardHorizontalSpacing+boardOffsetX; // set position
c.y = y*cardVerticalSpacing+boardOffsetY;
var r:uint = Math.floor(Math.random()*cardlist.length); // get a random face
c.cardface = cardlist[r]; // assign face to card
cardlist.splice(r,1); // remove face from list
c.addEventListener(MouseEvent.CLICK,clickCard); // have it listen for clicks
c.buttonMode = true;
addChild(c); // show the card
cardsLeft++;
}
}

// set up the score
gameScoreField = new TextField();
addChild(gameScoreField);
gameScore = 0;
showGameScore();

// set up the clock
gameTimeField = new TextField();
gameTimeField.x = 450;
addChild(gameTimeField);
gameStartTime = getTimer();
gameTime = 0;
addEventListener(Event.ENTER_FRAME,showTime);
}

// player clicked on a card
public function clickCard(event:MouseEvent) {
var thisCard:carta = (event.currentTarget as carta); // what card?

if (firstCard == null) { // first card in a pair
firstCard = thisCard; // note it
thisCard.startFlip(thisCard.cardface+2);
//playSound(theFirstCardSound);

} else if (firstCard == thisCard) { // clicked first card again
firstCard.startFlip(1);
firstCard = null;
//playSound(theMissSound);

} else if (secondCard == null) { // second card in a pair
secondCard = thisCard; // note it
thisCard.startFlip(thisCard.cardface+2);

// compare two cards
if (firstCard.cardface == secondCard.cardface) {
// remove a match
removeChild(firstCard);
removeChild(secondCard);
// reset selection
firstCard = null;
secondCard = null;
// add points
gameScore += pointsForMatch;
showGameScore();
//playSound(theMatchSound);
// check for game over
cardsLeft -= 2; // 2 less cards
if (cardsLeft == 0) {
MovieClip(root).gameScore = gameScore;
MovieClip(root).gameTime = clockTime(gameTime);
MovieClip(root).gotoAndStop("gameover");
}
} else {
gameScore += pointsForMiss;
showGameScore();
//playSound(theMissSound);
flipBackTimer = new Timer(2000,1);
flipBackTimer.addEventListener(TimerEvent.TIMER_COMPLETE,returnCards);
flipBackTimer.start();
}

} else { // starting to pick another pair
returnCards(null);
//playSound(theFirstCardSound);
// select first card in next pair
firstCard = thisCard;
firstCard.startFlip(thisCard.cardface+2);
}
}

// return cards to face-down
public function returnCards(event:TimerEvent) {
firstCard.startFlip(1);
secondCard.startFlip(1);
firstCard = null;
secondCard = null;
flipBackTimer.removeEventListener(TimerEvent.TIMER_COMPLETE,returnCards);
}

public function showGameScore() {
gameScoreField.text = "Score: "+String(gameScore);
}

public function showTime(event:Event) {
gameTime = getTimer()-gameStartTime;
gameTimeField.text = "Time: "+clockTime(gameTime);
}

public function clockTime(ms:int) {
var seconds:int = Math.floor(ms/1000);
var minutes:int = Math.floor(seconds/60);
seconds -= minutes*60;
var timeString:String = minutes+":"+String(seconds+100).substr(1,2);
return timeString;
}

public function playSound(soundObject:Object) {
//var channel:SoundChannel = soundObject.play();
}
}
}

Y este es que se usa en las cartas
package {
import flash.display.*;
import flash.events.*;

public dynamic class carta extends MovieClip {
private var flipStep:uint;
private var isFlipping:Boolean = false;
private var flipToFrame:uint;

// begin the flip, remember which frame to jump to
public function startFlip(flipToWhichFrame:uint) {
isFlipping = true;
flipStep = 10;
flipToFrame = flipToWhichFrame;
this.addEventListener(Event.ENTER_FRAME, flip);
}

// take 10 steps to flip
public function flip(event:Event) {
flipStep--; // next step

if (flipStep > 5) { // first half of flip
this.scaleX = .20*(flipStep-6);
} else { // second half of flip
this.scaleX = .20*(5-flipStep);
}

// when it is the middle of the flip, go to new frame
if (flipStep == 5) {
gotoAndStop(flipToFrame);
}

// at the end of the flip, stop the animation
if (flipStep == 0) {
this.removeEventListener(Event.ENTER_FRAME, flip);
}
}
}
}

Espero que me puedan ayudar.

Saludos

Por masterblade

5 de clabLevel



 

firefox
Citar            
MensajeEscrito el 10 Sep 2008 12:46 am
¡200 líneas de código, y encima sin formato!
Flipas

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.