Tushar’s Blog – BETA


Jump Algo in Flash

Posted in Flash, Games by Tushar Vaghela on May 31, 2008
Tags: , ,

Hi,

I could not fullfill promise that I’ll post daily but I am trying…..

This post is for Flash Developers who are doing game programming.

Open new Flash File, Create one MovieClip and Paste this code on MovieClip (Bad Practice, but focus on what it’s doing)

//————– Copy from here ——————-

//This is settign the initial values onLoad
onClipEvent (load) {

//Speed of the Object
//More Speed will make object go higher in sky....
//This can be mass of the object
startspeed = 10;
//Amount of Gravity, 9.8 is standard Gravity
//Use 0 as gravity and your object will be lost in space
//Will never come down...
//Can be used for animated background, with some random wind algo.
gravity = 9.8;
//Current Status
jumping = false;
//Initial position
startpos = 0;

}
onClipEvent (enterFrame) {

//If user press up key and object is not jumping
//This will make object jump
if ((Key.isDown(87) or Key.isDown(Key.UP)) and jumping == false) {

jumping = true;
starttime = getTimer()/1000;
startpos = this._y;

}else if(Key.isDown(Key.LEFT)){

_x -=5;

}else if(Key.isDown(Key.RIGHT)){

_x +=5;

}
if (jumping) {

time = getTimer()/1000-starttime;
_y -= (startspeed-gravity*time);
if (_y>startpos) {

_y = startpos;
jumping = false;

}

}

}

//————– Stop Copying ——————-

This code is taken from http://www.video-animation.com/flash_06.shtml

Sunday

Posted in Sundays by Tushar Vaghela on May 18, 2008
Tags: , ,

Hi,

Today was busiest sunday of my life. We have planned to manage our home since we have shifted here on last month but house was such a mess till today.

We planned to fix every thing which was like….

 Home on 5/18 Morning

and after spending hrs. it’s now …

Home in the Noon

Beside this we have washed 1000’s of cloths, and hang out with friends in great cafe nearby my house.

I know no one likes to know what I did this sunday (or any sunday or may be any day), but I have posted it cause I want to post it..

Game of the Week

Posted in Games by Tushar Vaghela on May 17, 2008
Tags: , ,
Games at Miniclip.com - Shanghai Mahjongg
Shanghai Mahjongg

Clear the board of stones by finding all the matching pairs.

This game was there in my 8-bit video game collection, but I could never figure out how to play it and as Mario is my all time favourite, I never tried hard to learn the game play. But today I am playing this game as part of my work and I must tell that this is the wonderful game and you should also try your luck with it….

Book I am reading …

Posted in Books by Tushar Vaghela on May 16, 2008
Tags: , , ,

The 3 mistakes of my life

I am currently readind Chetan Bhagat’s new “The 3 mistakes of my life”, I am in middle of the book and so far I think this book is not as good as the previous ones but sill I like the book cause it’s directly touching my heart – it’s Ahmedabad’s story. I know the places they are talking about, I have gone through earthquake, riots & all….. I don’t think it must read book but it’s good book.


Now I have finished the book and want to update my views, but will do it later.

Promise

Posted in Practice Post by Tushar Vaghela on May 15, 2008

Everyone is blogging now, even Big B is. So now I am promising myself to blog. Evenif no one is going to come on my blog. I’ll post it for me.

The subjecty of my post would be from Books, Games, Movies to my real life experiences…….

If you are visiting my blog and you are not Tushar Vaghela, Thank you for giving me your time.

Please do visit the “Game Page” to play some of my favourite flash games.