All Questions
Tagged with javascript sprites
40 questions
0
votes
0
answers
85
views
How to make objects appear on the map at a certain distance based on scale?
Mode7 - Sprites on Screen / Pseudo 3D
Scale x1:
Scale x16:
I'm trying to recreate this system with JAVASCRIPT:
https://github.com/vinibiavatti1/Mode7/blob/master/src/mode7/FlatModeSeven.java
The ...
0
votes
0
answers
97
views
Add a sprite, move with keys, Javascript example?
I have a small image (30x30 px) I want to use as a sprite on a Javascript screen to show students what Javascript can do. (They want to create games.) How do I link the image file to my Javascript ...
1
vote
0
answers
128
views
How to set pivot point for rotating a sprite?
Is there a way to set the pivot point for rotating a sprite? The default option seems to be arbitrarily chosen point on the sprite or the mid point.
...
4
votes
2
answers
647
views
Why use sprite tile maps on the GPU in WebGL?
I'm trying to figure out the best way of rendering my layered tiled maps with WebGL, and have come across this tutorial several times: https://blog.tojicode.com/2012/07/sprite-tile-maps-on-gpu.html
...
-1
votes
1
answer
101
views
I do not understand the code version of time based sprite animation?
I'm Universo and for the longest time had coding issues around the concept of time-based sprite animation basically, do not know how to implement it and any code or explanation simple or complex that ...
0
votes
0
answers
69
views
solid color to sprite (javascript game)
Hi I recently created a javascript game, in this game, math random is used to pick a random shape.
The shapes are in strings, and the associated numbers within the string are then used to show a color....
0
votes
1
answer
400
views
how to join the body of snake in 2D snake game
i'm making a snake game in javaScript from scratch. The problem is that the snake looks disjoint(see image). How can I connect the body(rectangles) of the snake?
here is the code of drawing snake:
<...
1
vote
0
answers
239
views
Junk movement with steady 60fps on Web canvas
I'm new to building games on canvas, and I'm trying to create one. But I encountered a problem with sprite movements. My sprites move is smooth, but sometimes it starts to "jump". FPS is stable 60 ...
0
votes
2
answers
453
views
Why is my spritesheet displaying all messed up in game?
I'm having an issue I don't quite understand, where my spritesheet is looping strangely and not showing the full sprite I want, even though I feel like I'm specifying it correctly. My code is in ...
1
vote
1
answer
52
views
How can I have more values in array on X axis than Y axis in my tilemap?
Following my old question Array of map data renders the map the opposite way after I got the answer to it and fixed my problem, I got another problem that occurs. If my ...
3
votes
2
answers
3k
views
HTML canvas how to create big game world and show only a part of it on canvas?
I originally created this question at stackoverflow but got no answers, so hopefully someone will be able to help me here.
So for the first time ever I'm making a html canvas game. So far I came up ...
0
votes
1
answer
59
views
My sprite is not listening to any keyboard keys
First time ever creating html canvas game. Once I finally got my sprite ant tiles drawn on the canvas, now I want to make my sprite interactive. Unfortunately, for some reason it is not working. I get ...
0
votes
1
answer
157
views
Why my canvas isn't showing anything after I put code in the loop for tile map?
My canvas stop showing anything when I want to display a tile 25 times. No errors. Here is the code:
...
0
votes
1
answer
85
views
DOM for GUI - display animated objects
I'm creating an HTML5 game using Canvas, but want to use DOM for the GUI for the reasons mentioned in there articles:
http://blog.sklambert.com/html5-game-tutorial-game-ui-canvas-vs-dom/
http://www....
3
votes
1
answer
952
views
DrawImage problem adjacent sprite?
Context
I'm building a 2D game from scratch in JS.
I'm drawing the map by using rpgmxp tilesets for the moment just to have some resources :
Each tile is 32*32 pixels. I'm using canvas API with <...
0
votes
1
answer
1k
views
Why Won't Image Drawing Work In JavaScript
In my game at the beginning the first thing that you'll see is a campfire with this code:
...
2
votes
1
answer
908
views
Sorting sprites above the surface of 3D mesh?
I'm having trouble getting sprites to display on top of a 3D mesh. My requirements are as follows:
Sprite should billboard
Sprite should not clip into the mesh
Sprite should be hidden when on the ...
0
votes
2
answers
4k
views
How add a sprite to canvas using JavaScript?
I'm very new to sprites and I'm trying to figure out how to use them. I want to use a simple solution. Something like this:
var c = document.getElementById ('canvas)
var ctx = c.getContext ('2d');
...
0
votes
1
answer
1k
views
Layers in PixiJS
I am using the PixiJS framework to create a 2D RPG Game.
How can I create a PIXI.Container with a transparent background which I can render on top of my main stage ...
4
votes
2
answers
2k
views
Javascript canvas rotating single sprite instead of entire context
I am trying to recreate asteroids, but I need the ship to rotate based on user input. I have w,a,s,d keys set to change the [pos] of the ship by 1 in the corresponding direction, but now, I need to ...
0
votes
1
answer
532
views
Trouble loading sprite from spritesheet with Phaser
I am working on re-creating a breakout clone to help me learn Phaser (following the overall design of jsbreakouts.org). Anyway, I have the start screen set up. From the start screen, I can transition ...
0
votes
1
answer
3k
views
add physics to a group or container body in phaser
I'm developing a HTML5 Phaser game. In this game I do have a Group which I would like to behavior as a physics body (arcade-physics).
It is a character with a lot of moving parts (sprites) inside ...
0
votes
2
answers
419
views
Struggling to define js sprite sheet
I've been working on this for a couple days, unable to get anything to load. Here is the whole page. Please help me find what I'm doing wrong. Right now, I'm only trying to render the first card in ...
1
vote
0
answers
490
views
Using canvas graphics instead of traditional sprites in phaser
I'm trying to learn Phaser (total beginner with mild JS experience) and I'm following tutorials and such where everything is using sprites. I'm trying to get by with basic canvas shapes instead of ...
5
votes
2
answers
3k
views
Animations with individual images in Phaser.js
So I have this game that I made a while back and I want to port it using Phaser.
The game is made using individual PNG files for all the animation frames, and there are over 100 of them.
From ...
2
votes
4
answers
3k
views
How can I scale up sprites but maintain visual quality?
I am using WebGL. I have an isometric grid which contains tiles. Some have 'tree' sprites on them. If I have my tree sprite loaded from a texture with a fixed resolution, when I zoom into the grid (...
1
vote
3
answers
1k
views
How to handle transparent pixels in a spritesheet
I am trying to correctly handle transparent pixels. I have a spritesheet that gave me the following:
The green body is the ground physics body and the gray body around the sprite is the sprite's ...
0
votes
1
answer
877
views
How to trim a sprite?
I have a spritesheet:
var spriteSheet = new createjs.SpriteSheet({
// ...
frames: { width:520, height:600, regX: 260, regY:300 }
// ...
});
I am ...
0
votes
1
answer
222
views
2D Hitboxing on an HTML image [duplicate]
I want to make a turn-based game where the player is given "opportunities for attack." An image of the in-game sprite character appears when it's the player's turn to attack. The player can mouseover ...
3
votes
1
answer
2k
views
How to use sprite as font in Unity?
I've started working on my first game in Unity; It's very simple, there's a spinning block in the middle, and there are spinning blocks coming from all sides. When they hit the middle block, you lose ...
1
vote
3
answers
1k
views
Is it more efficient to encode rotation in a spritesheet or rotate at runtime?
I'm developing a game with JavaScript and HTML5 and I'm wondering about the performance implications of sprite rotations. There are two ways that I know to rotate a sprite:
Rotate the actual sprite ...
0
votes
1
answer
148
views
Why does my goblin only choose a walk direction once? [closed]
I'm working on a simpe 2d canvas game that has a small goblin sprite who I want to get pathing around the screen.
What I originally tried was a random roll that would choose a direction, the goblin ...
1
vote
3
answers
202
views
Generating spritesheet(s) on load
I would like to reduce the size of the spritesheet I am loading by only loading the specific sprites I need. Is there a way to crop and splice images at runtime using javascript? Creating separate ...
2
votes
2
answers
12k
views
Moving a sprite towards an x and y coordinate
Given a sprite with an x and y coordinate, how would I move it toward another sprite with an x and y coordinate?
I've already made it face towards the other sprite, and I've made it move towards the ...
1
vote
1
answer
2k
views
Using copyrighted sprites [duplicate]
Possible Duplicate:
How closely can a game resemble another game without legal problems
I was thinking about making a pacman clone, I know there is a similar question here Using Copyrighted ...
1
vote
2
answers
155
views
Including sprite file for mobile games
I'm making a simple online RPG for Android & IOS using HTML5 & Phonegap and was wondering: should I include sprite file with the game for downloads (because of bandwidth)? What should I do ...
2
votes
1
answer
2k
views
Customize Colors for Sprites in Web Game
So I'm working on an html5/javascript/css3-based game. Without going into too much detail, I'm thinking of having the characters be simple 8 or 16-bit style sprites, but I'd like to allow the user to ...
7
votes
1
answer
3k
views
2d, Top-down map with different levels
So, I'm creating a 2d, top down, sprite based (tiled) game, and right now I'm working on maps (well, a map editor at the moment, but it will be creating my maps, so basically the same thing).
The ...
32
votes
2
answers
3k
views
In a browser, is it best to use one huge spritesheet or many (10000) different PNG's?
I'm creating a game in jQuery, where I use about 10000 32x32 tiles. Until now, I have been using them all separately (no sprite sheet). An average map uses about 2000 tiles (sometimes re-used PNG's ...
0
votes
1
answer
769
views
Minimalistic JavaScript sprite manipulation libraries [closed]
Are there (or can someone recommend) any minimalistic JavaScript based libraries for sprite(s) manipulation? Preferably DOM oriented.