1 Ağustos 2011 Pazartesi

flash banner yapma

Adım 1
Ctrl + J tuşuna basın ve resimde gördüğünüz ayarları yapın.
Frame rate değerinin 40 olduğuna dikkat edin.Normalde 12 değeri vardır bu 1 saniyede 12 frame ilerleyeceği anlamına gelir.

Adım 2
File-İmport-import to library yolunu takip ederek resimleri import edin.Aşağıdaki resimde olduğu gibi resimlerin library bölümünde olduğunu göreceksiniz.library paneli açık değil ise üst menüden window-library yolunu izleyerek ya da Ctrl+L kısa yolu ile açabilirsiniz.

Sıkı bi Ogün Sanlısoy fanı olduğum için resim seçimlerimde o yönde oldu :) Resimlerin boyutları 500×176 olduğu için Adım 1 de sayfa ayarlarını resim boyutu ile aynı yaptık.
Adım 3
Libraryde bulunan 1.jpg adlı resmi sahneye sürükleyin ve ardından sahneye ortalayın.

Align paneli açık değil ise Ctrl+K kısayolu ile açabilirsiniz.
Adım 4
1.jpg seçili iken F8 tuşuna basın ve movie cllip seçeneğini seçip tamam diyin.
Adım 5
40.frame seçili iken F6 tuşuna basarak key frame ekleyin.(1-40 arasında resmimiz ekranda görünecek)
55. frame içinde aynısını uygulayın.

Adım 6
Önce 40.frame yi ardından sahnemizde bulunan movie clipi seçin.Filters bölümünden + simgesine tıklayarak glow u seçin ve resimde gördüğünüz ayarları uygulayın.

Adım 7
55.framedeki resim için aşağıdaki ayarları yapın.
filters bölümünde + simgesine tıklayın ve glow u seçin.Arından resimde gördüğünüz ayarları yapın.

Adım 8
filters bölümünde + simgesine tıklayın ve Adjust color u seçin.Ardından resimde gördüğünüz ayarları yapın.

Adım 9
40. ve 55. frame arasında herhangi bir frameye sağ tıklayın ve motion tween efektini uygulayın.(40-55 arasında resmin tamamen beyaza dönüşerek gidiş efekti.)
Adım 10
1.Resim için efektimizi oluşturduk sıra 2. resimde
1.layeri kilitleyin ve 2.resim için yeni bir layer oluşturun.
Adım 11
2.layerda 50. frameye F6 ile key frame ekleyin.2.resmi sahneye sürükleyin ve ortalayın.F8 ile movie clipe dönüştürün.
65. e F6 ile keyframe ekleyin.
Adım 12
50 framedeki resme(2.resim) 55.framede bulunan resim için yaptığımız efekti , 65. framede bulunan resme 40 framedeki resme uyguladığmız efektleri uygulayın.
Motion tween uygulayın
Adım 13
50-65 arası 2. resmin geliş efektini uyguladık.(önce beyaz ardından resim oluşuyor.)Şimdi 40 framelik bir duraklama için 105 e F6 ile keyframe ekleyelim.
bundan sonra yapılacak işlemler.
2. resim için gidiş efektti.
Yeni bir layer ve 3 resimin geliş efekti.
3. resmin gidiş efekti.Bu şekilde kaç resim oluşturmak istiyorsanız oluşturun.
Son olarakta son layerimizi oluşturup 1.resim için geliş efekti uygulayalımki döngü bozulmasın.(Son frameden sonra en başa döneceği için)
Daha rahat anlayabilmeniz için aşğıdan kaynak dosyayı indirebilirsiniz.
Flash Banner Yapma
Takıldığınız bir yer olursa yorum yaprak sorabilirsiniz.Başka bir derste görüşmek üzere…
Berbat anlatımımın anlaşılmaması üzerine bir kaç ek bilgi :)
Çalışma ekranınızda görmeniz gereken görüntü aşağıdadır.

resmin devamı

flash ile yılan oyunu yapma

Step 1: Setting up the File

Start Flash, and click Create New: Flash File (Actionscript 2.0). You can set the stage size to whatever pleases you – I’ve set mine to 500 x 350. I do advise you to set the framerate to 30fps.
Now, you can either decide to follow this step and draw the required movieclips yourself, or you can skip ahead and use the ones I created. If you want to use the ones I created you can find them in the source file. Just add them to the library and drag them onto the stage. If you are going to draw your own: you don’t have to literally draw the same as I did, but do make sure you stick to the sizes.

Step 2: Create the Snake Pit

The first thing we’ll create is the pit for the snake to roam around. Create a rectangle of 400 x 250 and convert it to a movieclip. Make sure you pay attention to the registration point; make it top-left.
Make sure you give the snake pit the instance name snakepit and align it slightly above the center of the stage (so that we can add text below it later, without messing up the aesthetics).

Step 3: Create the Snake’s Head

Draw a square (perhaps with rounded corners) without a border (size 25 x 25) and copy it so you have 2 exactly the same. Convert one of them to a movieclip. Again, pay attention to the top-left registration.
Make sure you give it the instance name bodypart0 and double check that its size is 25 x 25.

Step 4: Snake’s Head ActionScript

Enter the “head” movieclip. Once inside it, add this line of code to the first and only frame:
  1. stop();  
Now, draw a little face on the snake’s head, so you can tell it apart from other bodyparts.

Step 5: Additional Face

Add a second frame to the “head” movieclip, and on this frame, draw a sad or dead face.

Step 6: Create the Other Bodyparts

Remember the duplicate square you created in step 3? We’re going to convert it to a movieclip now. Pay attention to the registration point again.
Make sure you give it the instance name bodypart.

Step 7: Create the Score Field

Create a dynamic text field below the right corner of the snake pit. Make sure you set the variable to score. Also, make sure the field is wide enough for several characters, and aligned to the right. The rest of the settings can be set according to your own style – I used Tahoma 24 Bold.

Step 8: Embedding the Font

Since it’s a dynamic text field, we’ll have to embed the font. Click the embed button in the properties panel (where you just defined the variable and text style).
You’ll see the popup shown below. Make sure you select Numerals [0..9].

Step 9: Create the Food

Draw a blue circle without a border, size 25 x 25, and then erase the center using the eraser tool. Now select the circle that remains and convert it to a movieclip. Alternatively, you can design a piece of food for yourself, as long as it remains 25 x 25.

Step 10: Food Instance Name

Give the food a suprising instance name of food. Double check that its size is 25 x 25.

Step 11: Adding Instructions

Left-below the snake pit seemed like a good place to put some pointers. Simply type the static text “Use the arrow keys to move” here. I know, arrow keys don’t function yet, but we’ll get to that shortly. I promise!

Step 12: Creating the Popup

Draw a white square (somewhere outside the stage, for now) and add the text “You died!” to it. This is the popup we’ll display after someone has lost a game.
Convert it to a movieclip, and give it the instance name popup as well. For alignment purposes, I’ve set the registration point to the center.

Step 13: Score

Double click on the popup you just created to enter it. Once inside it, create a dynamic text field (variable = score) and a button reading the text Play Again.
The button should be given the instance name againbutton.
Inside the button, you can create a slightly darker “Over” and even darker “Down” state.
Congratulations, you have created all the visual objects required for the snake game. Now over to the code!

Step 14: newgame Function

Before I throw a chunk of code at you, I’ll tell you what to do with it. All the code in this tutorial goes on the first and only frame of your movie. No need to attach it to buttons or anything. Now, have a look at this piece of ActionScript.
Editor’s Note: Sorry about this folks, the code syntax highlighter doesn’t want to display this particular chunk of ActionScript in FireFox. Take a look at the code here.
In a nutshell, this bit of code does the following. First, the original bodypart is made invisible – we’ll use duplicates soon. Some default values are (re)set, any duplicates left from the previous game are deleted. In the do { } while() loop, the food and bodypart0 (the head) are given an x and y coordinate. If this matches (so they are at the exact same spot), they are given a new coordinate, until we no longer have a match. Then, the arrays are set up in which we’ll contain the bodyparts’ x and y coordinates.

Step 15: Grabbing the Direction

In this bit of code, we create a keyListener object, which we attach to Key, which represents the keyboard. Whenever a key is pressed, the onKeyDown function is triggered. From the getCode() function, we’ll derive which key was pressed and then define the direction according to this. We’ll store this in the direction variable for later use. Remember: all the code of this tutorial goes on the first and only frame of your movie.
  1. keyListener = new Object();  
  2. keyListener.onKeyDown = function () {  
  3.     keycode = Key.getCode()  
  4.     if (keycode == 37) {  
  5.         direction = 'left'  
  6.     }  
  7.     else if (keycode == 38) {  
  8.         direction = 'up'  
  9.     }  
  10.     else if (keycode == 39) {  
  11.         direction = 'right'  
  12.     }  
  13.     else if (keycode == 40) {  
  14.         direction = 'down'  
  15.     }  
  16. };  
  17. Key.addListener(keyListener);  

Step 16: onEnterFrame Function

The function down here is a big one. It’s executed on every frame, but only really does something every 5 frames. It checks if the snake isn’t moving outside the box, and then moves all the bodyparts along to their new position. It then checks if the food is there too, and then eats it using the eat() function we’ll discuss later. Then, it checks if the snake is smashing into a wall, and lastly it checks if the snake bites itself in the tail. All these functions will be added soon (insideSnake(), dead(), etcetera). Remember: all the code of this tutorial goes on the first and only frame of your movie.
  1. this.onEnterFrame = function () {  
  2.     if (game) {  
  3.         if (framecount/5 == Math.ceil(framecount/5)) {  
  4.             if (!(bodypart0._y <= snakepit._y && direction == 'up') && !(bodypart0._y+bodypart0._height >= snakepit._y+snakepit._height-2 && direction=='down') && !(bodypart0._x+bodypart0._width >= snakepit._x+snakepit._width - 2 && direction =='right') && !(bodypart0._x <= snakepit._x && direction == 'left'))  
  5.             {  
  6.                 bodypartsy[0] = bodypart0._y;  
  7.                 bodypartsx[0] = bodypart0._x;  
  8.                 for (i=bodypartsy.length-1;i > 0; i--) {  
  9.                     eval('bodypart'+i)._y = bodypartsy[(i-1)]  
  10.                     eval('bodypart'+i)._x = bodypartsx[(i-1)]  
  11.                     bodypartsy[i] = eval('bodypart'+i)._y  
  12.                     bodypartsx[i] = eval('bodypart'+i)._x  
  13.                 }  
  14.             }  
  15.             if (food._x == bodypart0._x && food._y == bodypart0._y) {  
  16.                 eat()  
  17.             }  
  18.             if (direction) {  
  19.                 if (direction == 'up') {  
  20.                     if (bodypart0._y <= snakepit._y) {  
  21.                         dead()  
  22.                     }  
  23.                     else {  
  24.                         bodypart0._y-= bodypart0._width  
  25.                     }  
  26.                 }  
  27.                 else if (direction == 'down') {  
  28.                     if (bodypart0._y+bodypart0._height >= snakepit._y+snakepit._height-2) {  
  29.                         dead()  
  30.                     }  
  31.                     else {  
  32.                         bodypart0._y+= bodypart0._width  
  33.                     }  
  34.                 }  
  35.                 else if (direction == 'right') {  
  36.                     if (bodypart0._x+bodypart0._width >= snakepit._x+snakepit._width - 2) {  
  37.                         dead()  
  38.                     }  
  39.                     else {  
  40.                         bodypart0._x+= bodypart0._width  
  41.                     }  
  42.                 }  
  43.                 else if (direction == 'left') {  
  44.                     if (bodypart0._x <= snakepit._x) {  
  45.                         dead()  
  46.                     }  
  47.                     else {  
  48.                         bodypart0._x-= bodypart0._width  
  49.                     }  
  50.                 }  
  51.             }  
  52.             if (game) {  
  53.                 if (insideSnake(bodypart0._x,bodypart0._y,true)) {  
  54.                     dead()  
  55.                 }  
  56.             }  
  57.         }  
  58.         framecount++  
  59.     }  
  60. }  

Step 17: dead() Function

This one’s nice and easy. It executes the actions that need to be taken when the snake dies: the score needs to be defined in the popup, the popup shown, the snake’s dead-face shown and the game-variable set to false (as the game ended).
  1. function dead() {  
  2.     popup.score = 'score: '+(bodypartsx.length-1)  
  3.     popup.swapDepths(this.getNextHighestDepth())  
  4.     popup._visible = true  
  5.     bodypart0.gotoAndStop(2)  
  6.     game = false;  
  7. }  

Step 18: eat() Function

The function below is triggered in the onEnterFrame function we discussed earlier, when the food is picked up. It first duplicates a part of the snake’s body, then positions it at the spot of the last bodypart (so that it’ll join in the line on the next frame). Its coordinates are added to the coordinate containing arrays, and the food is repositioned (somewhere not inside the snake!). Also, the score is updated.
  1. function eat() {  
  2.     duplicateMovieClip(bodypart,'bodypart'+bodypartsy.length,this.getNextHighestDepth())  
  3.     bodypart0.swapDepths(this.getNextHighestDepth())  
  4.     eval('bodypart'+bodypartsy.length)._y = eval('bodypart'+(bodypartsy.length-1))._y  
  5.     eval('bodypart'+bodypartsx.length)._x = eval('bodypart'+(bodypartsy.length-1))._x  
  6.     bodypartsy.push(eval('bodypart'+bodypartsy.length)._y)  
  7.     bodypartsx.push(eval('bodypart'+bodypartsx.length)._x)  
  8.     do {  
  9.         food._x = snakepit._x + Math.floor(((snakepit._width-food._width)/food._width)*Math.random())*food._width  
  10.         food._y = snakepit._y + Math.floor(((snakepit._height-food._height)/food._height)*Math.random())*food._height  
  11.     } while(insideSnake(food._x,food._y));  
  12.     score = bodypartsx.length-1  
  13. }  

Step 19: insideSnake() Function

This function merely checks if the inputted coordinates match any of the coordinates of the snake’s bodyparts. If skiphead is set to true, it is allowed to match the head’s coordinates (when checking if the head bites its tail, this comes in handy).
  1.     function insideSnake(xneedle, yneedle,skiphead) {  
  2. if (skiphead) { startat = 1; }  
  3. else { startat = 0; }  
  4. for (q=startat; q<bodypartsx.length; q++) {  
  5.     if (bodypartsx[q] == xneedle) {  
  6.         if (bodypartsy[q] == yneedle) {  
  7.             return true;  
  8.         }  
  9.     }  
  10. }  
  11. return false;  

Step 20: The Popup Button

As a last bit of code; we still have to add an on-release function to the button inside the popup! It’ll trigger the newgame() function we discussed earlier, when clicked. Remember: all the code of this tutorial goes on the first and only frame of your movie – including this bit about the button!
  1. popup.againbutton.onRelease = function() {  
  2.     newgame()  
  3. }  

Step 21: Wrapping it All Up

I’m sure you’ve done this before, but now is the time: hit Ctrl+Enter (or Cmd+Enter on a Mac) to compile the swf file and test your game. It should now be fully functional. Enjoy!

Flash Ortamında Basit Flash oyunu yapımı

Biz muhtemelen bu oyunu daha önce oynadık: Aklından 0 - 1000 arası bir sayı tut ve karşıdaki bunu tahmin etsin. Tahminlere göre aşagı ya da yukarı diyerek dogru sayıyı bulmayı saglar.

Başlangıç :
Kolay bir başlangıç yapalım. Oyuncu sayıyı tahmin etmeyi denesin.
Bilgisayar rastgele bir sayı seçer.
1. Oyuncu bilgisayara bir sayı girer tahmin için.
2. Girilen sayı bilgisayaryn tuttuğuyla kıyaslanır.
3. Oyuncuya küçük ya da büyük denir.
4. İkinci tahmin saıysı girilir. Doğru sayıya kadar süreç devam eder.

Flashı çalıştırın ve aşağıdaki satırları girin.
Set Variable: "high" = 1000
Set Variable: "low" = 0
Set Variable: "Num" = Random (high) +1
Karşılaştırma :
Kiyaslama satirlari. Girilen sayiyi bilgisayarin tuttugu ile kiyaslar ve yüksek ya da alçak der.

If (/:hmGuess > /:Num)
Set Variable: "fback" = "Too High" / "çok yüksek"
End If
If (/:hmGuess < /:Num)
Set Variable: "fback" = "Too Low" / "çok düsük"
End If
If (/:hmGuess = /:Num)
Set Variable: "fback" = ""
Set Variable: "correct" = /:Num / "dogru tahmin"
Go to and Stop ("quit")
End If

Doğru sayı bulununca program sona erer.

Tahmini Değerlendirme
Siz de bilgisayar yerine sayı girebilirsiniz. Bunun için 1-2 satır ilave edilir.

On (Release, Key: )
Call("EvalGuess")
End On

Oyuncuya komutlarla iki seçenek sunma: Oyuncuya yeniden başla ya da çok demek için iki tuş seçenegi konur.

Tuş Kodu
Düşük ya da yüksek uyarisi verildikten sonra kullanıcıya bilgisayar tuşlarının hangileriyle programı kullanmaya devam edeceği gösterilir.

Çok Düşük:
On (Release)
Set Variable: "low" = PCNum
Call ("Guess")
End On

Çok Yüksek:
On (Release)
Set Variable: "high" = PCNum
Call ("Guess")
End On

Set Variable: "/:PCNum" = Int(((/:high) + (/:low)/2)

Doğru Tuş:
On (Release)
Set Variable: "correct" = /:PCNum
Go to and Play ("quit")
End On

Bitiş :
0 ile 1000 arası bir rakam PCNum : Int((1000 + 0)/2) or 500 formülü ile bulunur. Basic'teki RND komutu gibi...
Int((1000 + 500) /2) or 750. 1000 ile 500 arası bir rakam seçer.
kaynak: Bestflash

27 Temmuz 2011 Çarşamba

C#

C# Programlama Dili (si şarp şeklinde telaffuz edilir), Microsoft'un geliştirmiş olduğu yeni nesil dilidir. Yine Microsoft tarafından geliştirilmiş .NET Teknolojisi için geliştirilmiş dillerden biridir.
Microsoft tarafından geliştirilmiş olsa da ECMA ve ISO standartları altına alınmıştır.
C programlama dilinde bir tamsayı değişkeni 1 attırmak için ++ soneki kullanılır. C++ dili adını, C diliyle Nesneye Yönelimli Programlama yapabilmek için eklentiler (C With Classes) almıştır. Benzer şekilde C++ diline yeni eklentiler yapılarak ((C++)++) bir adım daha ileriye götürülmüş ve tamamen nesneye yönelik tasarlanmış C# dilinin isimlendirilmesinde, + karakterlerinin birbirlerine yakınlaşmış hali ve bir melodi anahtarı olan C# Major kullanılmıştır.
Bu dilin tasarlanmasına Pascal, Delphi derleyicileri ve J++ programlama dilinin tasarımlarıyla bilinen Anders Hejlsberg liderlik etmiştir.
Birçok alanda Java'yı kendisine örnek alır ve C# ta java gibi c ve c++ kod sintaksına benzer bir kod yapısındadır. .NET kütüphanelerini kullanmak amacıyla yazılan programların çalıştığı bilgisayarlarda uyumlu bir kütüphanenin ve yorumlayıcının bulunması gereklidir. Bu, Microsoft'un .Net Framewok'u olabileceği gibi ECMA standartlarına uygun herhangi bir kütüphane ve yorumlayıcı de olabilir. Yaygın diğer kütüphanelere örnek olarak Portable.Net ve Mono verilebilir.
Özellikle nesne yönelimli programlama kavramının gelişmesine katkıda bulunan en aktif programlama dillerinden biridir .NET platformunun anadili olduğu bazı kesimler tarafından kabul görse de bazıları bunun doğru olmadığını savunur.
C#.NET orta seviyeli programlama dillerindendir. Yani hem makine diline hem de insan algısına eşit seviyededir. Buradaki orta ifadesi dilin gücünü değil makine dili ile günlük konuşma diline olan mesafesini göstermektedir. Örneğin; Visual Basic.NET(VB.NET) yüksek seviyeli bir dildir. Dersek bu dilin insanların günlük yaşantılarında konuşma biçimine yakın şekilde yazıldığını ifade etmektedir. Dolayısı ile buradan yola çıkarak VB.NET, C#.NET'ten daha güclü bir dildir diyemeyiz. Programın çalışması gereken bilgisayarlarda framework kurulu olması gerekmektedir(Win7 ve Vista'da framework kuruludur)

10 Temmuz 2011 Pazar

python:)

#-*- coding:utf-8 -*-

from __future__ import division

a = "(1) toplama"
b = "(2) cikarma"
c = "(3) carpma"
d = "(4) bolme"

print a
print b
print c
print d

soru = raw_input("lutfen yapmak istediginiz islemin numarasini secin: ")

if soru == "1":
sayi1 = input("toplama icin ilk sayiyi girin: ")
print sayi1
sayi2 = input("toplama icin ikinci sayiyi girin: ")
print sayi1, "+", sayi2, "=", sayi1 + sayi2

if soru == "2":
sayi3 = input("cikarma icin ilk sayiyi girin: ")
print sayi3
sayi4 = input("cikarma ici ikinci sayiyi girin: ")
print sayi3, "-", sayi4, ":", sayi3 - sayi4

if soru == "3":
sayi5 = input("carpma icin ilk sayiyi girin: ")
print = sayi5
sayi6 = input("carpma icin ikinci sayiyi girin: ")
print = sayi5, "x", sayi6, ":", sayi5 * sayi6

if soru == "4":
sayi7 = input("bolme icin ilk sayiyi girin: ")
print sayi7
sayi8 = input("bolme icin ikinci sayiyi girin: ")
print = sayi7, "/", sayi8, ":", sayi7 / sayi8