How I made my CV, based on Age of Empires game

栏目: IT技术 · 发布时间: 6年前

How I made my CV, based on Age of Empires game

How I made my CV, based on Age of Empires game

# cv # javascript # web # ageofempires

How I made my CV, based on Age of Empires game ・3 min read

Hi there!

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

I think I'm not the best programmer to give some advice, my code is not clean at all, but maybe you can learn something new of my two day struggling to make a playable CV.

Information

The map is randomly generated, in each visit it can change the environment, weather, position of trees, buildings, music, etc.

You can move the villager arround the map with the cursor as the current game and if you want you can use the keyboard arrows too.

The Idea

I've to admit that the first moment my idea was not to make a CV, I wanted to replicate the user interface of Age of Empires with web technologies just for fun.

What I used

  • Graphics
  • Music and sounds from youtube videos
  • HTML
  • CSS
  • jQuery to write less code
  • Google fonts
  • Javascript library to make the snow effect from Trent Willis

The stages

1- Start with the basics

2- Little details

3- Responsive design

4- Polish the code

5- Get some feedback and improve it

Start with the basics

First thing I put on the map was the villager a simple DIV on the BODY tag, a plain image without fancy walking animations.

Then I add a DIV that is above all the DIV layers with a click event to move the villager arround the screen.

Then I put one tree, one house, one university, and so on..

Finally I put the informative modal that appears when the villager is over any building.

The best advice I can give is go step by step, try and failure, change and reload, don't give up if it doesn't work at the first time.

Little details

Once the basic interaction is done, the first detail I added was the eagle that flies from the top left or right to bottom of the screen.

Then I made the random environment, weather, music, sounds.. to give some life and personality to the plain website.

Did you notice when you move the villager there are two kind of sounds?

Responsive design

The CV website was made to work in desktop mode and mobile devices in vertical mode.

The main differences is the position of buildings that I will talk later in this post, the size of the buildings and the number of elements like trees and snow flakes that are smaller or lower in mobile devices.

Polish the code

I know the code it still can be improved by far, basically I remove some duplicate code.

1- For the interaction of each building I was using four "if" conditions then I've changed to one "while" and just one "if", I think its more simple and easy to mantain.

2- At the begining I was printing five trees individualy instead using a loop "for", so by this way is easy to print 10 or 20 trees, i've only to change one variable.

What have been the most difficult things for me?

At the begining the buildings can appear in any position of the screen, sometimes one building can appear above another one and it was a complete mess.

So i made virtual grid with an array, in desktop the screen is divided by two columns and two rows, in mobile is divided by one column and four rows proportional to the screen size.

All the buildings appers in a random position inside each cell of the virtual grid.

What other problems I found?

This is inevitable, you can't try your thing in each device in the world, as a Android user I don't have any iPhone, so someone with an iOS device told me that in Safari browser the images doesnt work, the solution was easy, I replace the WEBP images to PNG and GIF images instead.

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 Age of empires to bring back some good memories.

Disclaimer

The Copyright policy sets out information and rules for respecting Microsoft's copyrights and trademarks in its works. In order to reproduce any of Microsoft's content, including images, characters, storylines, or text, we must have Microsoft's clear permission to do so.


以上所述就是小编给大家介绍的《How I made my CV, based on Age of Empires game》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。

网络营销实战密码

网络营销实战密码

昝辉Zac / 电子工业出版社 / 2009.1 / 56.00元

本书是作者几年来网络营销实战的总结,与其他网络营销书籍最大不同之处是:只专注于实战,不谈理论。本书分三部分详细介绍了网络营销实用策略和技巧,并分析了大量实战案例。第一部分介绍市场与产品研究,包括用户、市场和竞争对手的调查;产品、目标市场的确定;价格策略;赢利模式等。第二部分讨论以网络营销为导向的网站设计,包括怎样在网站上卖东西、提高转化率,以及网站目标设定等。第三部分研究怎样给网站带来流量,详细讨......一起来看看 《网络营销实战密码》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

html转js在线工具
html转js在线工具

html转js在线工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具