resimli ingilizce adam asmaca oyunu

Kodla Büyü

tevfikdemir02

Aktif Üye
Mesajlar
129
okul web sitesinde kullanmak üzere kelime hazinesini geliştirmeye yönelik bir adam asmaca oyunu yaptım. kod bilgim çok zayıf olduğundan her yerde bulunan hazır bir kodu kullandım.
faydalı olması dileğiyle...
 

Ekli dosyalar

SAyın hocam emeğinize sağlık çok gözel olmuş. Kendiniz mi yaptınız. Ne kadar zamanda yaptınız
 
utf8' Alıntı:
SAyın hocam emeğinize sağlık çok gözel olmuş. Kendiniz mi yaptınız. Ne kadar zamanda yaptınız

teşekkür ederim hocam. kod normalde verdiğin kelimelerden rasgele birini seçip onu bulmayı öngörüyordu. resim falan yoktu. ben de önce resimleri küçülttüm. sonra her frame için aynı koda tek kelime yazdım. yazdığım kelimenin resmini de o frameye koydum. ileri geri butonları falan fonttur kağıt arkaplandır ekledim işte. yaklaşık 500 kelime var her kelime için aynı işlemleri tekrarladım.. nakış benzeri bişey oldu :)
okulda 7 12 çalışarak (teneffüste çay sigara) 3-4 günde bitti.
belki daha kolay bir yöntemi vardır ama benim kodlamam zayıf. o yüzden türk usulü yaptım :)

bizim okulun sitesinde yayınladım pek rağbet görmedi. site zaten genelde de rağbet görmediği için :) belki burda bikaç kişi sitesine koyar da çocuklara bi faydam dokunur diye burada da paylaştım.

fla dosyası var 65 mb kadar büyüklüğü değiştirmek isteyen olursa verebilirim.
 
Emek harcanarak yapılan her çalışma takdir edilmelidir.
Bazıları bir ürün yapmak için çaba harcamaz diğerlerinide küçük görür.
Flashın içine resimleri gömmek yerine dışardan harici bir dosya içinden çekilebilir. XML bu işi yapıyor
yada veri tabanına PHP ile bağlayarak veri çektirebilirsin.
Önemli olan ilk adımın atılması bundan sonra koşma işi zaman ve çabaya bakar
 
utf8' Alıntı:
Emek harcanarak yapılan her çalışma takdir edilmelidir.
Bazıları bir ürün yapmak için çaba harcamaz diğerlerinide küçük görür.
Flashın içine resimleri gömmek yerine dışardan harici bir dosya içinden çekilebilir. XML bu işi yapıyor
yada veri tabanına PHP ile bağlayarak veri çektirebilirsin.
Önemli olan ilk adımın atılması bundan sonra koşma işi zaman ve çabaya bakar

teşekkür ederim hocam
aslında en güzeli şöyle olurdu rastgele seçilen kelime yazılan bir kodla kendine bağlı olan resmi de ekranın belirlenen yerine getirebilirdi.
ama kodlama sıfıra yakın olduğu için yazamadım. hatta doğru cevap verildiğinde bi alkış sesi bile ekleyemedim.
benim kafa frame mantığıyla çalışıyor :)
yapabilecek bir arkadaş olursa çok memnun olurum. kalıcı ve güzel bir uygulama olur.
 
kodlama as2.0 mı yoksa 3.0 mı. fla dosyaya şıkıştırılınca ne kadar oluyor. Kodlamaya bi bakabilirim
 
hocam kodalama as 2.0. doğru anladımmı bilmiyorum ama random fla yok hocam.
random kelime kodu var sadece

Kod:
//Hangman Game by John Bezanis for swfspot.com

//Array containing all of the answers
gameanswers = ['yawn' ];
//Attach the missgraphic
this.attachMovie('missgraphic','missgraphic',this.getNextHighestDepth(), {_x:0,_y:80});


//Function that begins a new game
function newGame() {
	//select a random answer from the array
	answer = gameanswers[Math.floor(Math.random()*gameanswers.length)];
	//Add all 26 letter buttons to the stage
	for (curindex=0; curindex<26; curindex++) {
		//Use the character code for each letter to attach the letter
		attachMovie('guessletter', 'guess'+String.fromCharCode(curindex+65), this.getNextHighestDepth());
		//set the x position according to its position in the alphabet
		eval('guess'+String.fromCharCode(curindex+65))._x = (curindex%13-6.5)*(eval('guess'+String.fromCharCode(curindex+65))._width+3)+Stage.width/2;
		//set the y position according to its position in the alphabet
		eval('guess'+String.fromCharCode(curindex+65))._y = Stage.height-(2-Math.floor(curindex/13))*(eval('guess'+String.fromCharCode(curindex+65))._height-4);
		//set the character display to the current letter in the loop
		eval('guess'+String.fromCharCode(curindex+65)).displayletter = String.fromCharCode(curindex+65);
		//When the player clicks the button, call the pressLetter function with the letter set
		eval('guess'+String.fromCharCode(curindex+65)).onPress = function() {
			//process the letter
			pressLetter(this.displayletter);
			//remove the button from the stage
			removeMovieClip(this);
		};
	}
	//Determine how many characters are going to be printed on each line.
	//Keep the letters of words from being split onto different lines 
	//start the row count at 0
	curline = 0;
	//the start position in the answer is 0
	linestart = 0;
	//store the length of each line into an array
	var linelengths:Array = new Array();
	//traverse all of the characters in the answer
	for (linepos=0; linepos<length(answer); linepos++) {
		//Maximum length of each formatted line
		blanklinelength = 25;
		//check if the linelength is smaller than the max line length or the first word on the line is longer than the max
		if ((linepos-linestart)<blanklinelength || linelengths[curline] == undefined) {
			//if the current character is a space, set a marker so we know how long the line should be
			//it may be updated if another word fits within the current line
			if (answer.charAt(linepos) == ' ') {
				//update the length of the current line
				linelengths[curline] = linepos-linestart+1;
			}
			//else the line has reached its limit, so move to the next line and start at the end of the last word  
		} else {
			//store where to start the next line
			linestart = linestart+linelengths[curline];
			//move to that position
			linepos = linestart;
			//move to the next line
			curline++;
		}
	}
	//set the length of the last line
	linelengths[curline] = length(answer)-linestart;
	//Now we are going to add the blank holders to the stage
	//start at the first row
	currow = 0;
	//set the position to 0
	curpos = 0;
	//Loop through the answer and add the blank holders to the stage
	for (curindex=0; curindex<length(answer); curindex++) {
		//If the current position is a space, do not create a blank holder
		if (answer.charAt(curindex) != ' ') {
			//add the letter holder
			attachMovie('letterholder', 'holder'+curindex, this.getNextHighestDepth());
			//set the x position relative to its position on the line and the number of characters on the line
			eval('holder'+curindex)._x = 500+((curpos-(linelengths[currow]/2))*20);
			//set the y position according to the currow
			eval('holder'+curindex)._y = 410+(currow-(linelengths.length/2))*20;
			//if the current character is not A-Z, display it
			if (!hiddenCharacter(answer.charAt(curindex))) {
				//display the character, since it is a special character
				eval('holder'+curindex).displayletter = answer.charAt(curindex);
			}
		}
		//If we are at the end of a row, go to the next row 
		if (++curpos>=linelengths[currow]) {
			//move to the next row
			currow++;
			//reset the position to the left
			curpos = 0;
		}
	}
}

//This function checks if the input character is an A-Z character
function hiddenCharacter(curchar) {
	//Set of characters that aren't revealed
	hiddenchars = 'abcdefghijklmnopqrstuvwxyz';
	//Loop through the character set
	for (charindex=0; charindex<length(hiddenchars); charindex++) {
		//If the input character is in the list, hide it
		if (curchar.toLowerCase() == hiddenchars.charAt(charindex)) {
			return true;
		}
	}
	//character is not A-Z, so display it
	return false;
}

//function called each time a letter button is pressed
function pressLetter(pressedletter) {
	//check if the pressed letter is in the answer
	if (!inAnswer(pressedletter)) {
		//update the graphic to the next image
		missgraphic.gotoAndStop(missgraphic._currentframe+1);
		//check if the last frame has been reached
		if (missgraphic._currentframe == missgraphic._totalframes) {
			//game lost. remove all of the remaining buttons
			for (curindex=0; curindex<26; curindex++) {
				//if the letter button exists, remove it
				if (eval('guess'+String.fromCharCode(curindex+65))) {
					//delete the button. 65 is the ascii character A
					removeMovieClip('guess'+String.fromCharCode(curindex+65));
				}
			}
			//the game has been lost, so fill in all of the blank spaces with the answers in red
			for (curindex=0; curindex<length(answer); curindex++) {
				//if there is a space or the letter has been guessed already do nothing
				if (answer.charAt(curindex) != ' ' && eval('holder'+curindex).displayletter == undefined) {
					//the letter has not been guesed, so reveal it and make it red
					eval('holder'+curindex).displayletter = answer.charAt(curindex);
					eval('holder'+curindex).letter.textColor = '0xFF0000';
				}
			}
			//Display the button to start a new game
			showPlayAgainButton();
		}
	}
}

//This function checks to see if a guessed letter is in the answer
function inAnswer(pressedletter) {
	//initialize goodletter to false. 
	//we are going to loop through the answer to see if the guessed letter is in the answer
	goodletter = false;
	//check if there are any letters in the answer that haven't been guessed yet
	blankspace = 0;
	//loop through the answer
	for (curindex=0; curindex<length(answer); curindex++) {
		//check if the guessed letter is the character in the current position of the answer 
		if (answer.charAt(curindex).toLowerCase() == pressedletter.toLowerCase()) {
			//display the character
			eval('holder'+curindex).displayletter = answer.charAt(curindex);
			//setting goodletter to true prevents the image from going to the next frame
			goodletter = true;
			//if the character at the current position hasn't been guessed, reveal it
		} else if (answer.charAt(curindex) != ' ' && eval('holder'+curindex).displayletter == undefined) {
			//there is at least one letter that hasn't been guessed
			blankspace = 1;
		}
	}
	//if every letter has been guessed, the player wins
	if (!blankspace) {
		//remove all of the guess buttons
		for (curindex=0; curindex<26; curindex++) {
			//if the button at the current position exists, remove it
			if (eval('guess'+String.fromCharCode(curindex+65))) {
				removeMovieClip('guess'+String.fromCharCode(curindex+65));
			}
		}
		//loop through all of the characters and set their color to green
		for (curindex=0; curindex<length(answer); curindex++) {
			//if the current character isn't a space, set its color to green
			if (answer.charAt(curindex) != ' ') {
				eval('holder'+curindex).letter.textColor = '0x00AE00';
			}
		}
		//show the play again button
		showPlayAgainButton();
	}
	//return whether or not the guessed letter exists in the answer 
	return (goodletter);
}

//Show the button to play again
function showPlayAgainButton() {
	//attach the button
	attachMovie('playagain', 'playagain', this.getNextHighestDepth());
	//move it to the middle of the screen
	playagain._x = Stage.width/2;
	//move it towards the bottom
	playagain._y = 370;
	//Add a listener for when the button is pressed. When pressed, start a new game
	playagain.onPress = function() {
		//Reset the hangman graphic to the first frame
		missgraphic.gotoAndStop(1);
		//loop through all of the letter holders of the answer on the screen and delete them
		for (curindex=0; curindex<length(answer); curindex++) {
			//if the current position in the answer isn't a blank, remove it
			if (answer.charAt(curindex) != ' ') {
				removeMovieClip('holder'+curindex);
			}
		}
		//start a new game
		newGame();
		//delete this button
		removeMovieClip('playagain');
	};
}

//Start a new game when the applet loads
newGame();

şeklinde. answers bölümüne kelimeleri yazıyoruz. onlardan random seçim yapıyor.
resimler de web için png olarak kaydettim photoshopta. 400x400 boyutlarında. şimdi yanımda değiller ama 2 3 mb tutar heralde 500 resim.

eksik ya da yanlış anladıysam düzeltin hocam :)
 
random yanlışlıkla oldu. Kodları incelemek gerekiyor. Biraz zaman alabilir
 
ilginize çok teşekkür ederim hocam.
oyunun ilk oynanmamış haline baktım da okulda kalmış.
diğer movie clipler falan içinde daha pratik olur.
yarın onu da eklerim..
 
swf decompiler ile extract ettim. Baktığım kadarıyla 490 frame kadar kodları yazmışsınız aslında buna gerek yoktu. Asıl ana menüde şu aralıkta rasgele (Random)bir frame git denilebilir. Bu şekilde rasgele soru gelir. Ben as2 ile uğraşmadım yaptıklarım hep as3 ile oldu. Eğer kodları As3. e göre yapabilirsem derlerip gönderirim
 
hocam her framede soruyu getiren zaten o uzun anlaşılmaz kod. yanlış hatırlamıyorsam ham halinde sadece 1 frame vardı. sadece kodun içindeki answers bölümünde kelime fazlaydı. tek framede resimleri kütüphaneden seçilen random kelimeye bağlantılı olarak çekerseniz harika bi iş yapmış olursunuz hocam.
şu anda benim yaptığım da söylediğime benziyor ama ben kulağa dünyanın etrafını dolaşıp uzanıyorum :)
 
Ana sayfada ve ileri geri buonlarına

gotoAndStop(8); yerine

şunları eklersen
max = 50; // en büyük frame
min = 5; // en küçük frame
this.gotoAndStop( (Math.floor (Math.random() * (max - min + 1)) + min));

rasgele frame seçer
Ayrıca kodları kısaltmak için movie clip içine almaya çalışacağım
 
Nihayet bitti.
Verileri dışarıdan XMLile çekiyor.
Resimler harici dosyadan alınıyor.
Sorular rasgele seçiliyor.
AS3 ile uğraşamadam. AS2 de oldu bu sayede AS2 le de ilk çalışmamı yapmış oldum
 

Ekli dosyalar

Resimler 200x200 px boyutunda olmalı.Fazlası taşıyor
Kelime.xml dosyası içindeki resim ve yazılar artırılarak oyun büyütülebilir
 
hocam eline sağlık çok güzel olmuş.
benimkinden çok daha pratik ve kullanışlı olmuş.
xml dosyalarını okulun web sitesine atma imkanımız varmı?
malum ftp yok, başka bir yöntem varsa da ben bilmiyorum..
 
BBNET
Geri
Üst