Salam…

Kindly be noted that this for my school project – Games Programming 2. This is not a tutorial. In order to complete the subject, I am required to develop a 3D game based on Visual Studio using directX. Back from ‘lepaking’ (in PD), I was poking around looking for ideas, tutorials, etc., I found this tutorial most helpful. Probably would keep hanging around throughout the semester.

Texture filters, lighting & keyboard control.

Create a DirectX 3D World

Making a Diablo-like game.

DirectX basics.

I will keep editing this page for my personal references….by any chances, might helped anyone bumped onto this lame blog (I know, I’m too lazy to blog….too many people hang out in my room).

Salam….

Aku rasa, aku nak mula balik aktif menulis blog. Aku dah mula rasa Facebook terlalu muda utk aku. Kalau nak disimpulkan semuanya, aku dah hambar dengan Facebook & intipatinya. Cuti – MMU dah mula cuti semester & akan mulakan semester baru pada 17hb Oktober 2011. Walaupun agak perlahan berbanding cuti sebelum semester lepas, namun aku rumuskan sebagai menarik.

Dah lama rasanya aku tak buat perangai macam dulu; main game sampai tengah hari esoknya, lepak dengan Z sampai lebam, lepak rumah klik road trip (Aie, Ejan, Sharom, etc.) bahagian Port Dickson. Semua ni aku dah tak boleh tahan lama. Mungkin betul Z selalu cakap, aku dah tua. Hah!

Dalam perjalanan aku ke rumah Z tadi, selingan gambaran memori-memori lama – aku tersengih seorangan (maafkan aku kalau cubaan aku kekalkan tatabahasa Bahasa Melayu…aku tahu, janggal iramanya). Betul, aku dah semakin lanjut usia & perbualan kami (Aie & Ejan) juga timbulnya destinasi yang sama. Bila aku nak habis belajar. Jawapannya? Aku sendiri tak tahu. Namun, aku tahu aku akan bersungguh.

Z datang.

Game Dev: Day 2

Posted: August 14, 2011 in The World According to Me

Salam…

After much altering, repairing & debugging, the algorithm turns out much of what I’m expecting. Although, few more algorithm seems not working out since 6 hours ago (have to break fast first & guling2 = 3 hours total).  After last post, the health bar is working but not in a proper way — it keep reducing although the enemies hasn’t hit the player yet. Anything else is working perfectly like enemy randomly spawn & targeting the player. However, I did not managed to make the keyboard inputs function running. The function is in the Player class & supposed to be kicking the functions when testing. If anyone out there stumbled across this post, please do help (This is my first game & have not learn ActionScript before).

This is the Player class code:

package  {

	import flash.display.MovieClip;
	import flash.display.Stage;
	import flash.events.KeyboardEvent;
	import flash.events.Event;
	import flash.ui.Mouse;
	import flash.ui.Keyboard;

	public class Player extends MovieClip {

		private var stageRef:Stage;

		private var rightKeyisDown:Boolean = false;
		private var leftKeyisDown:Boolean = false;
		private var upKeyisDown:Boolean = false;
		private var downKeyisDown:Boolean = false;

		private var playerSpeed:Number = 7;
		private var vx:Number = 0;
		private var vy:Number = 0;
		private var totalHealth:Number=1;

		public function Player(stageRef:Stage):void {
			// constructor code
			this.stageRef = stageRef;

			addEventListener(Event.ENTER_FRAME, HitTest);
			addEventListener(KeyboardEvent.KEY_DOWN, PressAKey);
			addEventListener(KeyboardEvent.KEY_UP, ReleaseAKey);
			addEventListener(Event.ENTER_FRAME, moveThePlayer);

		}

		public function HitTest(event:Event):void
		{
			if (hitTestPoint(this.x, this.y, true))
			{
				//if the value of totalHealth more than 0
				if (totalHealth>0)
				{
					//reduce the totalHealth by 0.05
					totalHealth-=0.05;
					//trace("Ouch!");
				}
				//if the value of totalHealth is less than or equal 0
				if (totalHealth<=0)
				{
					//make the totalHealth vaule become 0
					totalHealth=0;
					//trace("You're Dead");
				}
				dispatchEvent(new Event("hit"));
			}
			//make the x scale of healthBar movie clip same as totalHealth value
			MovieClip(root).healthBar.scaleX = totalHealth;
		}
		private function PressAKey(event:KeyboardEvent):void
		{
			if(event.keyCode == Keyboard.RIGHT){
				rightKeyisDown = true;
			}
			if(event.keyCode == Keyboard.LEFT){
				leftKeyisDown = true;
			}
			if(event.keyCode == Keyboard.UP){
				upKeyisDown = true;
			}
			if(event.keyCode == Keyboard.DOWN){
				downKeyisDown = true;
			}
		}

		private function ReleaseAKey(event:KeyboardEvent):void
		{
			if(event.keyCode == Keyboard.RIGHT){
				rightKeyisDown = false;
			}
			if(event.keyCode == Keyboard.LEFT){
				leftKeyisDown = false;
			}
			if(event.keyCode == Keyboard.UP){
				upKeyisDown = false;
			}
			if(event.keyCode == Keyboard.DOWN){
				downKeyisDown = false;
			}
		}

		private function moveThePlayer(event:Event):void
		{
			if(rightKeyisDown)
			{
				x += playerSpeed;
				scaleX = 1;
			}
			if(leftKeyisDown)
			{
				x -= playerSpeed;
				scaleX = -1;
			}
			if(upKeyisDown)
			{
				y -= playerSpeed;
				scaleY = 1;
			}
			if(downKeyisDown)
			{
				y += playerSpeed;
				scaleY = -1;
			}
		}// End of player movement function
	}
}

Next, I’ll be adding the mouse click function, mouse rotation function & Bullet class. What’s the point of playing the game if you can’t do much. The idea is to shoot & survive the waves. In future enhancement, I was thinking of having a shop & adding stat points to the player’s attribute…but only after I’ve done the main goal of the game. Sekian…

Game Dev: Day 1

Posted: August 4, 2011 in Map of My Head

Took me long enough to learn ActionScript 3.0. 2 weeks….the more I learnt, the less I felt I know the language – it amazes me how dynamic OOP can be. Although during the research & learning phase, I did almost gave up. Trial & error – that’s all it takes. For my first game, I’m planning to develop a flash game of surviving AI waves which also includes keyboard & mouse inputs. The original idea was to create a side-scrolling game with the same idea (I found it tedious to set enemy’s spawn point, gravity & so on….tried & I can’t seem to kick out the error).

 

Before I lost track of my goals, these are the algorithm & problem I must solve:-

  • Player char still cannot move although I’ve put keyboard input function.
  • Enemies spawned only at one point (should be random).
  • Need to write a Bullet class.
  • Must be able to separate Enemy & Player class functions accordingly (e.g: enemy.hitTestPoint, player.HPbar, etc.). So that I know where to look when there’s a ‘bug’.
  • Player must be able to shoot out bullets.
  • Player must be able to target according to mouse rotation.
  • Create a Score & Health Bar HUD first (later I can add shop, gold, etc.).

So far, these are what I managed to accomplished:-

  • When enemy “hit” the player, the health bar is reduced.
  • The enemy can spawn randomly but when I separate them functions into a class, most functions won’t work.
  • Note: Don’t put the Movieclip into the stage – leave it in the library.

Dilemma: Paradox.

Posted: August 4, 2011 in Map of My Head

Masalah demi masalah muncul. Salah satu dugaan bulan Ramadhan juga. Lepas waktu berbuka, sebatang rokok demi sebatang rokok aku hisap. Masalah tetap muncul selepas satu permasalahan selesai. Baru aku tahu nak develop game ni mencabar akal. Aku sekarang dalam dilemma majoriti & minoriti – Aku sendiri terkadang runsing dengan mana satu permasalahan yang sebenar, mana satu yang patut aku dahulukan. Di masa-masa aku jaga dari tidur, aku belajar benda baru tentang Action Script 3.0. Setiap hari benda yang baru aku jumpa & makin banyak aku lihat, makin kecil rasanya ilmu yang aku pelajari. Dan bila aku nak tambahkan code, masalah tambah – perbezaan antara cara & idea tulisan coding. Belum lagi ditambah dengan masalah “app.crash” acapkali.

 

Alamak, dah nak masuk waktu berbuka. Sambung lepas makan nanti.