Visualizzazione dei risultati da 1 a 8 su 8
  1. #1
    Utente di HTML.it
    Registrato dal
    Dec 2002
    Messaggi
    1,786

    [ActionScript] Gioco da Migliorare

    Salve Amici,

    sto sviluppando con Flash Mx una versione del vecchio gioco di Arkanoid.

    La mia versione la trovate qua

    Funziona tramite un file Asp e un Db Access 2000.

    Io ho riscontato questi Bug:

    1) A volte finiscono i mattoncini e non passa al livello successivo

    2) A volte non compare la pallina

    3) Ma sopratutto il bug principale sono i rimbalzi della pallina.

    Per i primi 2 Bug penso di sistemarli mettendo un preload,
    ma il terzo non so come fare

    mi conviene passare a ActionScript 2.0 per usare qualche funzione nuova ?

    Cmq. ora vi posto il mio codice, se c'è qualcosa che non va per favore me lo corregete o migliorate ?

    Grazie !
    [Scambio Links a Tema] Contattatemi in Privato x + Info.

  2. #2
    Utente di HTML.it
    Registrato dal
    Dec 2002
    Messaggi
    1,786
    questo e tutto il codice principale:

    codice:
    stop();
    startLevel = 1;
    theScore = 0;
    if (useMouseOn == undefined)
    	useMouseOn = 1;
    	
    gBallBaseLoc = [208, 329];
    gThePaddle = [_level0["paddle"]];
    gGameRect = [19, 15, 397, 372];
    gHMax = pGameRect[2]-5;
    maxLevels = 10; // Livelli Max
    TileCountx = 13;
    TileCounty = 17;
    theNumberOfBalls = 1;
    theCurBallNum = 1;
    ballsLeft = 2;
    pauseBall = 0;
    setPause = 0;
    if (playsound != 1)
    	soundbg.gotoAndStop(2);
    
    
    function moveTheBalls () {
    	for (x=1; x<=theNumberOfBalls; x++) {
    		thisBall = theBallsList["ball"+x];
    		if (!thisBall == 0) {
    			thisBall.moveBall();
    
    		}
    	}
    }
    function newBallList (startBallNum) {
    	this["ball"+startBallNum] = new newBall("ball"+startBallNum);
    }
    
    function addNewBall () {
    	theCurBallNum++;
    	theBallsList["ball"+theNumberOfBalls] = new newBall("ball"+theNumberOfBalls);
    	resetPaddleandBall();
    }
    
    function newBall (instName) {
    	duplicateMovieClip ("ball", instName, theNumberOfBalls);
    	this.name = instName;
    	this.MovieClip = _level0[instName];
    	this.MovieClip._x = gBallBaseLoc[0];
    	this.MovieClip._y = gBallBaseLoc[1];
    	this.deltaX = getRandom(-5, 5);
    	this.deltaY = -5;
    	this.HitNum = 0;
    }
    newBall.prototype.moveBall = function () {
    	if (pauseBall == 0)
    	{
    		this.MovieClip._x += this.deltaX;
    		this.MovieClip._y += this.deltaY;
    
    		for (i=0; i<=aktTiles; i++) {
    			thisTile = gTargetList[i];
    			
    			if (this.MovieClip.hitTest(_level0[thisTile]))
    			{
    				obj1_hwidth = (getProperty(this.MovieClip, _width)/2);
    				obj1_hheight = (getProperty(this.MovieClip, _height)/2);
    				obj2_hwidth = (getProperty(_level0[thisTile], _width)/2);
    				obj2_hheight = (getProperty(_level0[thisTile], _height)/2);
    				
    				obj1_x1 = getProperty(this.MovieClip, _x)-obj1_hwidth;
    				obj1_x2 = Number(getProperty(this.MovieClip, _x))+Number(obj1_hwidth);
    				obj1_y1 = getProperty(this.MovieClip, _y)-obj1_hheight;
    				obj1_y2 = Number(getProperty(this.MovieClip, _y))+Number(obj1_hheight);
    				obj2_x1 = getProperty(_level0[thisTile], _x)-obj2_hwidth;
    				obj2_x2 = Number(getProperty(_level0[thisTile], _x))+Number(obj2_hwidth);
    				obj2_y1 = getProperty(_level0[thisTile], _y)-obj2_hheight;
    				obj2_y2 = Number(getProperty(_level0[thisTile], _y))+Number(obj2_hheight);
    				
    				if ((Number(obj2_x1)<=Number(obj1_x2)) && (Number(obj2_x1)>=Number(obj1_x1))) {
    					this.deltaX = -5;
    				}
    				if ((Number(obj2_y1)>=Number(obj1_y1)) && (Number(obj2_y1)<=Number(obj1_y2))) {
    					this.deltaY = -5;
    				}
    				if ((Number(obj2_x2)<=Number(obj1_x2)) && (Number(obj2_x2)>=Number(obj1_x1))) {
    					this.deltaX = 5;
    				}
    				if ((Number(obj2_y2)>=Number(obj1_y1)) && (Number(obj2_y2)<=Number(obj1_y2))) {
    					this.deltaY = 5;
    				}
    				_level0[thisTile].play();
    			}
    		}
    		if (this.MovieClip.hitTest(_level0.paddle) && this.deltaY > 0) {
    			this.paddleHit(_level0.paddle);
    			_level0.soundbalken.play();
    		}
    		
    		if (this.MovieClip._y>(gGameRect[3]+20)) {
    			theBallsList[this.name] = 0;
    			removeMovieClip(this.MovieClip);
    			theCurBallNum--;
    			if (theCurBallNum<=0) {
    				ballsLeft--;
    				_level0.soundaus.play();
    				if (ballsLeft<0) {
    					// Game over
    					ballsLeft = 0;
    					gotoAndStop (5);
    				} else {
    
    				addNewBall();
    				checkLives();
    				pauseBall = 1;
    				ball1.deltaX = getRandom(-5, 5);
    				ball1.deltaY = -5;
    				}
    			}
    		}
    		
    		if (this.MovieClip._x<=gGameRect[0] || this.MovieClip._x>=gGameRect[2]) {
    			this.flipX();
    		}
    
    		if (this.MovieClip._y <= gGameRect[1])
    		{
    			this.flipY();
    		}
    	}
    }
    
    newBall.prototype.serveBall = function () { 
    	this.MovieClip._x = gBallBaseLoc[0];
    	this.MovieClip._y = gBallBaseLoc[1];
    	this.deltaX = getRandom(-5, 5);
    	this.deltaY = -5;
    }
    
    newBall.prototype.flipY = function () { 
    	this.deltaY *= -1;
    }
    
    newBall.prototype.flipX = function () {
    	this.deltaX *= -1;
    }
    
    newBall.prototype.paddleHit = function (thePaddle) { 
    	this.deltaX = (this.MovieClip._x - thePaddle._x)/4;
    	this.flipY();
    	this.MovieClip._y = Math.min(this.MovieClip._y, (thePaddle._y)+10);
    }
    
    newBall.prototype.increaseSpeed = function(){
    	if(this.deltaY < -18 || this.deltaY > 18){
    
    	}else{
    		this.hitNum ++;
    		if(this.hitNum > 3){
    			this.hitNum = 0;
    			if(this.deltaY > 0){
    				this.deltaY ++;
    			}else{
    				this.deltaY --;
    			}
    		}
    	}
    }
    
    function resetGame () 
    {
    	pauseBall = 1;
    	maxTiles = 0;
    	aktTiles = 0;
    	hitTiles = 0;
    	TilestoHit = 0;
    	gTargetList = [];
    	brickArray=new Array();	
    	
    	clearAllTiles();
    	checkLives()
    	
    	ball1._x = gBallBaseLoc[0];
    	ball1._y = gBallBaseLoc[1];
    	ball1.deltaX = getRandom(-5, 5);
    	ball1.deltaY = -5;
    	paddle._x = gBallBaseLoc[0];	
    	// Load File Asp
    	loadVariables("Livello.asp?level="+startLevel,dataloader);
    	level_movie.strlevel = "Level " + startLevel;
    	level_movie._visible = true;
    
    }
    
    function checkForXtraBall (theBallName) {
    	var xtraBallNum = xtraBallList.length;
    	for (i=0; i<xtraBallNum; i++) {
    		if (theBallName eq xtraBallList[i]) {
    			return 1;
    		}
    	}
    }
    
    function getRandom (x, y) {
    	return Math.round(Math.random()*(y-x))+x;
    }
    
    function checkLevel()
    {
    	if (Number(_level0.hitTiles) >= Number(_level0.TilestoHit)) 
    	{
    		if (startLevel < maxLevels)
    		{
    			startLevel += 1;
    			_level0.resetGame();
    		} else {
    			_level0.level_movie.strlevel = "DURCHGESPIELT ;)";
    			_level0.level_movie._visible = true;
    		}
    	}
    }
    
    
    function clearAllTiles()
    {
    	for (i=0; i<=aktTiles; i++) 
    	{
    		removeMovieClip("tile"+i);
    	}
    }
    
    
    function checkLives()
    {
    	for (i=1; i<=ballsLeft+1; i++)
    	{
    			removeMovieClip("lebenball"+i);
    	}
    	
    	for (i=1; i<=ballsLeft; i++)
    	{
    			lebenName = "lebenball"+i;
    			duplicateMovieClip("lebenball0",lebenName,999+i);
    			_level0[lebenName]._x = 12+i*12;
    	}
    }
    [Scambio Links a Tema] Contattatemi in Privato x + Info.

  3. #3
    Utente di HTML.it
    Registrato dal
    Dec 2002
    Messaggi
    1,786
    questi sono i comandi

    codice:
    onClipEvent (enterFrame) {
    	
    	if (_level0.setPause == 0)
    	{
    		if (_level0.pauseBall == 1)
    		{
    			_level0.ball1._x = this._x
    		}
    		if(_level0.useMouseOn)
    		{
    			this._x = _level0._xmouse;
    		}
    		else 
    		{
    			if(Key.isDown(Key.LEFT)){
    				this._x -= 15;
    			}else if(Key.isDown(Key.RIGHT)){
    				this._x += 15;
    			}
    		}
    
    		if(this._x < 38){
    			this._x = 38;
    		}else if(this._x > 377){
    			this._x = 377;
    		}
    	}
    }
    [Scambio Links a Tema] Contattatemi in Privato x + Info.

  4. #4
    Utente di HTML.it
    Registrato dal
    Dec 2002
    Messaggi
    1,786
    il dataload

    codice:
    onClipEvent(data)
    {
    		_level0.resetTiles();
    }
    
    onClipEvent (mouseDown) {
    	if (_level0.setPause == 1) 
    	{
    		_level0.setPause = 0;
    		_level0.level_movie._visible = false;
    		_level0.play();
    	}
    	if (_level0.pauseBall == 1)
    	{
    		_level0.pauseBall = 0;
    		_level0.level_movie._visible = false;
    	}
    }
    [Scambio Links a Tema] Contattatemi in Privato x + Info.

  5. #5
    Utente di HTML.it
    Registrato dal
    Dec 2002
    Messaggi
    1,786
    altre funzioni

    codice:
    function resetTiles()
    {
    	aktTiles = 0;
    	rowArray0 = _level0.dataloader.asparray0.split(','); 
    	brickArray[0]=rowArray0;
    
    	rowArray1 = _level0.dataloader.asparray1.split(','); 
    	brickArray[1]=rowArray1;
    
    	rowArray2 = _level0.dataloader.asparray2.split(','); 
    	brickArray[2]=rowArray2;
    
    	rowArray3 = _level0.dataloader.asparray3.split(','); 
    	brickArray[3]=rowArray3;
    
    	rowArray4 = _level0.dataloader.asparray4.split(','); 
    	brickArray[4]=rowArray4;
    
    	rowArray5 = _level0.dataloader.asparray5.split(','); 
    	brickArray[5]=rowArray5;
    
    	rowArray6 = _level0.dataloader.asparray6.split(','); 
    	brickArray[6]=rowArray6;
    
    	rowArray7 = _level0.dataloader.asparray7.split(','); 
    	brickArray[7]=rowArray7;
    
    	rowArray8 = _level0.dataloader.asparray8.split(','); 
    	brickArray[8]=rowArray8;
    
    	rowArray9 = _level0.dataloader.asparray9.split(','); 
    	brickArray[9]=rowArray9;
    
    	rowArray10 = _level0.dataloader.asparray10.split(','); 
    	brickArray[10]=rowArray10;
    	
    	rowArray11 = _level0.dataloader.asparray11.split(','); 
    	brickArray[11]=rowArray11;	
    
    	rowArray12 = _level0.dataloader.asparray12.split(','); 
    	brickArray[12]=rowArray12;
    
    	rowArray13 = _level0.dataloader.asparray13.split(','); 
    	brickArray[13]=rowArray13;
    
    	rowArray14 = _level0.dataloader.asparray14.split(','); 
    	brickArray[14]=rowArray14;
    
    	rowArray15 = _level0.dataloader.asparray15.split(','); 
    	brickArray[15]=rowArray15;
    	
    	rowArray16 = _level0.dataloader.asparray16.split(','); 
    	brickArray[16]=rowArray16;	
    	
    		for (row=0; row<TileCounty; row++) {
    			for (brick=0; brick<TileCountx; brick++) {
    				brickNum=brickArray[row][brick];
    				maxTiles++;
    				if (brickNum!=0) {
    					gTargetList[aktTiles] = String("tile"+(aktTiles));
    	
    					clipName = "tile"+aktTiles;
    					clipDepth = row*100 + brick;
    					
    					duplicateMovieClip("initial_brick",clipName, clipDepth);
    					if (brickNum == 9) {
    						_level0[clipName].gotoAndPlay("Goldener Stein");
    					} else if (brickNum == 8) {
    						_level0[clipName].gotoAndPlay("Grauer Stein");					
    						TilestoHit++;						
    					} else {
    						_level0[clipName].color.gotoAndStop(brickNum);
    						TilestoHit++;
    					}
    						
    					_level0[clipName]._y = row*18+20;
    					_level0[clipName]._x = 28+brick*30;
    
    					if (row == 0)
    						_level0[clipName].enlargeblocker = 1;
    					else
    						_level0[clipName].enlargeblocker = 0;
    	
    					aktTiles++;				
    				} 
    		
    			}	
    		}
    }
    codice:
    onClipEvent (enterFrame) {
    	
    	if (_level0.setPause == 0)
    	{
    		if (_level0.pauseBall == 1)
    		{
    			_level0.ball1._x = this._x
    		}
    		if(_level0.useMouseOn)
    		{
    			this._x = _level0._xmouse;
    		}
    		else 
    		{
    			if(Key.isDown(Key.LEFT)){
    				this._x -= 15;
    			}else if(Key.isDown(Key.RIGHT)){
    				this._x += 15;
    			}
    		}
    
    		if(this._x < 38){
    			this._x = 38;
    		}else if(this._x > 377){
    			this._x = 377;
    		}
    	}
    }
    [Scambio Links a Tema] Contattatemi in Privato x + Info.

  6. #6
    considerato che:

    - il testo da leggere è lungo..
    - risolvere codeAS così lunghi mi mette in ansia VVoVe: e non solo..
    - il tempo che ci vorrebbe, sarebbe di quelli da computare..

    tutto ciò considerato/premesso..
    direi che la soluzione è possibile ottenerla solamente lavorando sul fla.. (almeno questo personalmente)


    Interactive Html/CSS/JS Playground | @webbeloz ( cip..cip! )
    Mechanics & Expert Tuning Fix Z3 Roadster Community

  7. #7
    Utente di HTML.it
    Registrato dal
    Dec 2002
    Messaggi
    1,786
    ti ho mandato un Msg. Privato
    [Scambio Links a Tema] Contattatemi in Privato x + Info.

  8. #8
    Utente di HTML.it
    Registrato dal
    Dec 2002
    Messaggi
    1,786
    up ho ancora il progetto farmo

    chi mi aiuta per favore ?

    grazie !
    [Scambio Links a Tema] Contattatemi in Privato x + Info.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.