Skip to content

MonkeyBlog

Lora Noto Sans Ag

More adventures

Hello World!

A little journey back to the past and why I started this blog

Latest post

The Parallax Effect

Adding Cool Graphics

In the previous post, I focused on testing with Matter.js and creating a simple car. In this post, I’m going to take it to the next level. Since my background is in UX design, I really wanted to add some graphics to this game to make it more fun to play. Matter.js has some simple methods to add textures to different objects. First, we’ll add some graphics to the car elements. You can add a sprite to any Matter.Bodies element. It’s very simple:

render: {
    sprite: {
        texture: <url to texture.png>,
        xScale: 1, // 1:1 scaling
        yScale: 1 // 1:1 scaling
    }
}
[...] Read more about this article