Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Pixelbox

Create 2D games in JavaScript, made easier · By Cedric Stoquer

Coding with Pixelbox.js

A topic by Cedric Stoquer created Apr 12, 2020 Views: 4,484 Replies: 14
Viewing posts 1 to 7

Pixelbox API documentation and source code is available on GitHub

Deleted 3 years ago

look at my comment on the beginner tutorial here, abhimonk replied with some good information about that

(+1)

I want to rotate the tilemap sprites or character sprites, but the word "rotate" is only mentioned once in the entire documentation. Is it even possible?

(-1)

what do u mean like in game or when your making your map

I have the same question, how do I adjust the rotation of a sprite Ex: make the character face a different direction like 45*

(+3)

Sprites can only be rotated by 90° increments using flip flags.

A work-around to make 45° rotation would be to draw another version of your sprite.

For those wondering, I've figured it out.

In the editor, at the top of the tile sheet, there's three buttons for flipping sprites horizontally, vertically or rotating it 90 degrees. You can use that if you want to flip tiles and place them inside the map.

In the code, there are additional arguments for flipping for sprite and draw functions. Check the documentation under the Drawing Graphics category.

How can i detect collisions between tiles and sprite?

(+1)

You have to do it the old fashioned way - comparing values. In the most basic of senses, comparing positions in relation to your character is basically what you'll be doing all the time. Tile based games are simpler, but with velocity added it becomes a bit harder.

how do i do that?

Find the coordinates of the sprites ie top right, top left, bottom right, bottom left corners. Then check whether any of those points overlap. Here's a tutorial on it that should be helpful. https://developer.mozilla.org/en-US/docs/Games/Tutorials/2D_Breakout_game_pure_J...

Hi how do i make collision (walls or smthn)?

(1 edit)

(With tilemap)

I Was Making Lot Easier and bigger than PixelBox.js API Name is PixelBox.JS++

VsCode Mega SupportFirst I will add