Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
November 1, 2020 10:54 am GMT

How I made my Resume, based on Mario Bros game

Hi there!

My name is Miquel Camps, I'm a freelance web developer based in Spain, you can find me on twitter and linkedin.

You can visit the Resume website here
https://vivirenremoto.github.io/mariocv/en.html

The the source code is on github
https://github.com/vivirenremoto/mariocv/

Controls

You can move Mario to the left or to the right using keyboard arrows on desktop or the arrows buttons on mobile.

What I used

  • Graphics
  • Music and sounds from youtube videos
  • HTML
  • CSS
  • jQuery (to write js code with less pain)
  • Google fonts

The stages

1- Start with the basics
2- Little details
3- Polish the code
4- What have been the most difficult things for me?
5- What other problems I found?

Start with the basics

On the screen there are 5 objects:

  • Mario
  • Sky (clouds + mountains)
  • Floor
  • Information boxes
  • Arrow buttons

The steps to make this from zero are:
1- Write the HTML
2- Write the CSS
3- Write the Javascript and cry
4- Test, test, test
5- Polish the code

Little details

Mario object is a simple IMG html tag and the src value is a transparent image, yes as you read, the image is really applied using the CSS attribute background.

To create the Mario moving animation there is a sprite image with 3 frames like this.
alt Mario

To change one frame to another, I'm using the attribute "background-position-x" and javascript:

  • Frame 1, background-position-x: 0px;
  • Frame 2, background-position-x: -65px;
  • Frame 3, background-position-x: -130px;

To change the perspective of moving Mario to left or right, I'm using the same image file, but I'm applying the CSS attribute "-webkit-transform":

  • Left, -webkit-transform:scaleX(-1);
  • Right, -webkit-transform:scaleX(1);

Polish the code

In the first version there is a lot of duplicate code in the user controls when user press the keys or click the arrow buttons, so I put the code in functions.

What have been the most difficult things for me?

All the javascript interaction, dealing with time intervals, the controls on desktop and mobile.

What other problems I found?

Some browsers like Google Chrome not allow to autoplay music, so I have to play the music when users starts some interaction, for example click the screen, press the keys or click the arrow buttons.

Final message

I hope you like it, get some inspiration and it would be great if you can share it to your family and friends who ever play once Mario Bros to bring back some good memories.

Disclaimer

All content on this website, including articles, artwork, screen shots, graphics, logos, digital downloads and other files, is the property of Nintendo, unless owned by a third party, and is protected by German and international copyright, trademark and other intellectual property laws. Trademarks and copyrights for third-party games and characters are owned by the companies that market or license those products.


Original Link: https://dev.to/vivirenremoto/how-i-made-my-resume-based-on-mario-bros-game-1pip

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To