Sound is a vital part of a game, as it helps to bring the interactivity and gameplay to a new level. Without sound, it would loose alot of the charm. I added sound to my game with a few simple commands. First I had to import flash.sound and soundchannel. Without these, flash would not play the sound. The I created some Variables importing my sound from the flash file, and then set the sound to play.
In addition to background music I created a jump sound that would play each time he, of course, jump. This was done by entering sc2 = jumpSound.play(); in my jumpcode. The sc2 means that the sound will be played in sound channel 2, and will not overlap the background music.
Monday, 16 November 2009
Caze 8
in this case we had to create something called Arrays and Timers. We would have to lay out some objects, that would give us points, and we would use arrays for that task. what is good about arrays is that you can easily create many objects at the same time, and insert a command that these objects would respond to, instead of putting the objects out one at a time and insert manually a command to each of these.
In my game, I wanted to put out objects and gain more health, instead of gaining points. I formed the array objects as standard cakes, and also made a health icon top left corner. This icon scales itself and symbolises how much health the character has. the less health, the smaller icon.
To create the array I wrote a variable with :Array, and imported the icon from the fla file. I also added a new variable with with a :int , which would symbolise how much life I start with. In this case I used the number 30.
To remove the cakes when the character touched them I created a new function, where I wrote that if main chracter hitTestObject the cake, it would removeChild, thus remove the cake. by adding the a [s] at the end of Array, it would remove the cake my character hit.
For making the Healthicon, I created several movieclips with different size of the icon. I then imported them into Actionscript, and used a hpnumber variable(which was set to 30), and then used a changeanimation code to make the icon change if my hpnumber decreased. I coded that the hpnumber would decrease if my character hitTest the Bean, thus decreasing the hpnumber with "--".
I did not add a timer, as my game does not need it. But if I were to create it, I could add it with importing a timerEvent and a Timer, and then add a function that would control the timer.
In my game, I wanted to put out objects and gain more health, instead of gaining points. I formed the array objects as standard cakes, and also made a health icon top left corner. This icon scales itself and symbolises how much health the character has. the less health, the smaller icon.
To create the array I wrote a variable with :Array, and imported the icon from the fla file. I also added a new variable with with a :int , which would symbolise how much life I start with. In this case I used the number 30.
To remove the cakes when the character touched them I created a new function, where I wrote that if main chracter hitTestObject the cake, it would removeChild, thus remove the cake. by adding the a [s] at the end of Array, it would remove the cake my character hit.
For making the Healthicon, I created several movieclips with different size of the icon. I then imported them into Actionscript, and used a hpnumber variable(which was set to 30), and then used a changeanimation code to make the icon change if my hpnumber decreased. I coded that the hpnumber would decrease if my character hitTest the Bean, thus decreasing the hpnumber with "--".
I did not add a timer, as my game does not need it. But if I were to create it, I could add it with importing a timerEvent and a Timer, and then add a function that would control the timer.
Caze 7
This case was about creating an enemy that had some sort of AI. I created my enemy as a Bean Worker, as it would seem fitting to my gamestory. I created three different animations for him: Walkcycle, hitcycle and death.
The Beanworker was supposed to have enough AI to follow my character and hit him when my main character got too close. I did this by creating a new actionscript file containing information about the Beans walk direction to my main character. The speed and gravity on the Bean Worker was also added in this new actionscript file. I then named the .as file the same name as my exportname of my beanworker (BeanWorker), and when I import my character in my main actionscript file, it will also run this 2nd actionscript file.
I also got it playing the hitanimation by writing a hitTestObject. command. Now when my main character touches the enemy, my character will begin his hit-cycle.
The problems I detected was to activate my new actionscript file (BeanWorker.as) with my main file. I did not know that they had to have same name. After I found that out, I could begin clean my main actionscript file by cutting out coding of the beanworker to the new actionscript file.
The Beanworker was supposed to have enough AI to follow my character and hit him when my main character got too close. I did this by creating a new actionscript file containing information about the Beans walk direction to my main character. The speed and gravity on the Bean Worker was also added in this new actionscript file. I then named the .as file the same name as my exportname of my beanworker (BeanWorker), and when I import my character in my main actionscript file, it will also run this 2nd actionscript file.
I also got it playing the hitanimation by writing a hitTestObject. command. Now when my main character touches the enemy, my character will begin his hit-cycle.
The problems I detected was to activate my new actionscript file (BeanWorker.as) with my main file. I did not know that they had to have same name. After I found that out, I could begin clean my main actionscript file by cutting out coding of the beanworker to the new actionscript file.
Monday, 26 October 2009
Caze 6
In this case we had to think over our story in the game, and add stuff to the story. I already created the story in the game in case 1, and the only change is that when the madman is released from the bombshelter, he will encounter his worst enemy, beans from space. :)
Saturday, 24 October 2009
Caze 5
In this case we had to create the foreground and code in physix and gravity. The character would also get a new movement, the jump. I also wanted the camera to follow the character as he moved along the screen.
However, I encountered a big problem with my character when I followed the example. When my character stood in his Idle animation in the game, he started floating up and down unexpectedly. It looked like the hitbox tot he character were increasing each time his head went up and down, and so the character levered. After much failing I found out that I had to remove a height code in my actionscript file, that caused this jmuping. And my character finally started to walk and idle normally.
Also we had to code in a jump. We could try to experiment with the velocity of the jump, and see what acceleration in the jump would fit in on our character. After a while, I found out that I wanted my character to have a not so high jump, and rather try to code in a double jump (if I push jump two times, he would jump higher) as it would increase the gameplay a bit.
However, I encountered a big problem with my character when I followed the example. When my character stood in his Idle animation in the game, he started floating up and down unexpectedly. It looked like the hitbox tot he character were increasing each time his head went up and down, and so the character levered. After much failing I found out that I had to remove a height code in my actionscript file, that caused this jmuping. And my character finally started to walk and idle normally.
Also we had to code in a jump. We could try to experiment with the velocity of the jump, and see what acceleration in the jump would fit in on our character. After a while, I found out that I wanted my character to have a not so high jump, and rather try to code in a double jump (if I push jump two times, he would jump higher) as it would increase the gameplay a bit.
Caze 4
In this case we had to make our character move on the screen when we push a keyboard button. Through some more coding, my character can now walk on the screen accordingly to left and right buttons. It also goes into idle mode if none buttons are pressed or both pressed simultaniously.
We had to write an event code, that if for example left arrow was pushed down, the arrow left would be "true". The character would then respond to this, and move the character left.
Lots of problems were encountered, but most of them were spelling and {} faulties. I solved it by mostly following the tutorial we were given from school, and learned alot.
We had to write an event code, that if for example left arrow was pushed down, the arrow left would be "true". The character would then respond to this, and move the character left.
Lots of problems were encountered, but most of them were spelling and {} faulties. I solved it by mostly following the tutorial we were given from school, and learned alot.
Case 3
Finished case 3. Had to make the character move on the screen through coding. It was the first time i had been writing anything in Actionscript 3.0. And we had to try to follow another code.
Among the problems, i found that the worst enemy was misspelling any code, as it would get you an instant error.
Among the problems, i found that the worst enemy was misspelling any code, as it would get you an instant error.
Subscribe to:
Posts (Atom)