How to switch window manager in Ubuntu linux

First you have to install another window manager.

To install LXDE:

sudo apt-get install lxde

Install XFCE:

sudo apt-get install xubuntu-desktop

Read more ›

Posted in linux, ubuntu Tagged with: ,

2Dworld update!

I have fixed some bugs in 2Dworld and now you can use collected blocks to build something

Posted in gamedev, Uncategorized Tagged with:

2dworld update!

2dworld3

Now you can dig! 2dworld is inspired by Minecraft and Terraria. Terrain is generated by php script and is random and allways different just like in roguelike games.

Posted in gamedev, javascript Tagged with:

How to make javascript animation

There are many ways to make animation in javascript. Here is one of them.

 

Prepare some pictures – frames for yor animation:

21

Put this in the index.html:

<html>
<head>
</head>
<body>
<div id="var"></div>
<div id="frame"></div>
<script src="script.js"></script>
</body>
</html>

and this in the script.js:

var mloop;
var x=0;

var MyLoop = function(){
if(x==0)
{
document.getElementById("frame").innerHTML = "<img src='1.jpg'/>";
x=1;
}
else
{
document.getElementById("frame").innerHTML = "<img src='2.jpg'/>";
x=0;
}
mloop = setTimeout(MyLoop, 300);
document.getElementById("var").innerHTML = x;
}

MyLoop();

And here is the working example

Posted in javascript Tagged with:

Javascript key code

Here is how to read code of pressed keyboard button.

Put this in the index.html:

<html>

<head></head>

<body>

press any key

<br>

<div id="vars"></div>

<script src="myscript.js"></script>

</body>

</html>

Put this in to myscript.js file:

 

var kc;

document.addEventListener('keydown', function(event) {
kc = event.keyCode;
document.getElementById("vars").innerHTML = kc;

});

Now start index.html and you should see key codes in your browser.

Here is the working example

Posted in javascript

Categories