11 abr 2008

Mario Bros Escrito En JavaScript

Lo que se puede hacer programando, ¡eh!, imitar clásicos como Mario Bros, aquí una muestra hecho en JavaScript, un lenguaje orientando a objetos y que se usa bastante para páginas Web's.


Después de jugar un poco a este minijuego, me dan ganas de jugar al Mario Bros, de verdad!! (risas).

Obviamente, le queda mucho por hacer, pero me pareció anecdótico ^^.

Aquí les pongo un extracto del código que usa el Autor (Jacob Seidelin).
Escogí este trocito, porque es la parte, donde si Mario Bros "escacha" a una de las setas, esta muere y gana 100 puntos.

Si quieres ver el código entero, mira aquí.

// player has x collision with goomba
if (iHitX <= 0.5 && iHitX >= -1.5) {
// player has y collision with goomba
if (iHitY <= 0.5 && iHitY >= -1.5) {
// player above goomba and moving down, kill goomba
if (iPlayerMovementY > 0 && toInt(oGoomba.style.top) > iNewY) {
oGoomba.de = 1;
oGoomba.style.top = toInt(oGoomba.style.top) + iPixSize * 2;
showHide(oGoomba.childNodes[0]);
showHide(oGoomba.childNodes[1]);
showHide(oGoomba.childNodes[2], 1);
bKilledGoomba = true;
addPoints(100);
}
else
{
// close x contact
if (iHitX <= 0.5 && iHitX >= -1.5) {
// kill player
die();

Links:

2 comentarios:

Anónimo dijo...

Hello. This post is likeable, and your blog is very interesting, congratulations :-). I will add in my blogroll =). If possible gives a last there on my blog, it is about the Home Theater, I hope you enjoy. The address is http://home-theater-brasil.blogspot.com. A hug.

Nu dijo...

Hi!! ^^ Thanks you for you visited!! and your comments!.

I have a question for you, your blog is about techology or general?

I like it, your style the blog, is style like "Mac OS", very nice ^^

Sorry for my english (haha).

I hope see you soon ^^ a hug!