Should I use HTML5 Canvas for a 2D image browser / 2D app?

Ok, I hope that was not asked, but I could not find one, especially nothing new.

Fast background: I did not program for a couple of years and wiped out an old project to create a browser game that is already quite functional and that I would like to finalize, but actually as IOS / Android app instead of a desktop browser game,

Current technology uses: CodeIgniter Framework, PHP, SQLite, Javascript / JQuery (and of course HTML / CSS)

Understanding the game: The game itself is basically a civilization building an empire-type game. The game area is a background image in a DIV element with spaces for building things. Once "built", the buildings are isometric images that are absolute floated with CSS and aligned above the background to appear where they were built in the city. I think that paints the picture, but basically these "buildings" (floating pictures) are also links that open up additional dialogues and provide more game functionality.

Example of a game layout

My question: Note that all images in my game are static, except that the images are properly aligned over the background image.

  • Should I actually use an HTML5 < canvas > Element for this task?

  • Is the UI also included in the artboard? (that's maybe one
    separate question)

  • Should I use an HTML5 framework to work with the artboard?

  • Does it change if I want to publish on IOS / Android?
    instead of desktop browser experience (ie Apple review process)?

Or are both methods just the wrong approach? hah i hope i have kept this as clear as possible and thank you for your time and your contributions !!

P.S. I should also say that my current strategy is to continue to program it as a browser game (by checking the Chrome developer tools to see what it looks like on my phone) and assuming that I can pack it later. But if that's wrong, I want to do it.

Java – Split-screen creation with the Game class canvas extension

My first attempt in a 2D two-player game in Java. The problem I come across is that I try to divide the window in half so that two people can play against each other. I successfully managed to split the screen with GridLayout, but the second half is completely white. I can not use it add.frame(game); twice to display the game twice? It seems like it might work, but it will create two windows, if I prefer that it's just one. Otherwise, the window will be displayed well if it is not split and I could implement a camera object to track player 1. I have provided both Game () and Window () for reference. I also read about getSubimage. Is that a better way to achieve my goal?

     public Game() {
        handler = new Handler();
        new Window(1000,563, "GameObjects.Tank Wars", this);
        start();

        camera = new Camera(0,0);
        this.addKeyListener(new KeyInput(handler));


        BufferedImageLoader loader = new BufferedImageLoader();
        level = loader.loadImage("/Tank_Level_Big.png");
        //level = loader.loadImage("/Tank_Level.png");
        sprite_sheet = loader.loadImage("/sprite_sheet.png");

        ss = new SpriteSheet(sprite_sheet);

        floor = ss.grabImage(4,2,32,32);

        //this.addMouseListener(new MouseInput(handler, camera, this, ss));

        loadLevel(level);
    }
    public void render() {
        BufferStrategy bs = this.getBufferStrategy();
        if (bs == null) {
            this.createBufferStrategy(3);
            return;
        }

        Graphics g = bs.getDrawGraphics();
        Graphics2D g2d = (Graphics2D) g;
        //////////////////////////////////////////////
        //// This is where graphics is displayed /////

        //g.setColor(Color.red);
        //g.fillRect(0,0, 1000, 563);

        g2d.translate(-camera.getX(), -camera.getY());

        for (int xx=0; xx<30*72; xx+=32) {
            for (int yy=0; yy<30*72; yy+=32) {
                g.drawImage(floor, xx, yy,null);
            }
        }

        handler.render(g);

        g2d.translate(camera.getX(), camera.getY());

        //hp Player 1 display
        g.setColor(Color.gray);
        g.fillRect(5,5,200,32);
        g.setColor(Color.green);
        g.fillRect(5,5,hpPlayer1*2,32);
        g.setColor(Color.black);
        g.drawRect(5,5,200,32);

        //ammo display player 1
        g.setColor(Color.white);
        g.drawString("Ammo: " + ammoPlayer1,10,50);

        //Player 1 total points
        g.setColor(Color.GREEN);
        g.drawString("Points: " + pointsPlayer1, 110, 50);

        //hp Player 2 display
        g.setColor(Color.gray);
        g.fillRect(780,5,200,32);
        g.setColor(Color.green);
        g.fillRect(780,5,hpPlayer2*2,32);
        g.setColor(Color.black);
        g.drawRect(780,5,200,32);

        //ammo display player 2
        g.setColor(Color.white);
        g.drawString("Ammo: " + ammoPlayer2,790,50);

        //Player 2 total points
        g.setColor(Color.GREEN);
        g.drawString("Points: " + pointsPlayer2, 890, 50);

        ///// End of Graphics Displayed /////
        /////////////////////////////////////
        g.dispose();
        bs.show();
    }
public class Window {
    public Window(int width, int height, String title, Game game) {
        JFrame frame = new JFrame(title);

        // size of frame
        frame.setPreferredSize(new Dimension(width, height));
        frame.setMaximumSize(new Dimension(width, height));
        frame.setMinimumSize(new Dimension(width, height));

        /*frame.setSize(new Dimension(width, height));
        GridLayout layout = new GridLayout(2,1);
        frame.setLayout(layout);*/

        frame.add(game); //add in game class to frame
        //frame.add(game);

        frame.setResizable(false); //cannot resize window
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setLocationRelativeTo(null); //when game started box will start center of window
        frame.setVisible(true); //lets us see window
    }
}

Enter image description here

View WebGL HTML5 Canvas in two blogger blog posts individually but not together?

In the blogger

I have a recent blog post


and a document.getElementById () stmt

var canvaspmet = document.getElementById('my_Canvas1');

Another older post has two screens:


var canvastemp = document.getElementById('mycanvas');

and


var canvas = document.getElementById('my_Canvas');

The problem now is that the WebGL will not work if the two blog posts are displayed on a page.
When I open individual posts, they work flawlessly and I get the right pictures in each blog post.

What could be the problem? I used a unique ID for each canvas in each post.

How can you find comfortable and stylish women's shoes online?

How can you find comfortable and stylish women's shoes online?

How can you choose the perfect pair of shoes?
Choosing the perfect pair of shoes can be a bit tricky. There are different types of styles and colors for women's shoes. Different heel heights are also available in these shoes. For every outfit, a matching shoe must be worn to get a full look. If you are looking for shoes that match the casual outfits, you can opt for ankle boots, canvas shoes and pointed toe shoes. The ankle boots can be worn with skinny jeans. The canvas shoes go well with the boyfriend jeans. To get the formal look, you can wear pumps.

These cheap shoes come in many colors and this looks very decent with the formal outfits. And for the party look, you have a wide selection of shoes to choose from. The high heels, high heels, platform shoes, etc. are perfect for a party night. You can easily find cheap shoes for women online. There are very attractive colors and styles in the shoes. Berrylook has many fashionable shoes that you can wear on different occasions.

Know the right pair of shoes
There are some professional tips to help you choose the right pair of women's shoes online.
· Matching the color of the bag – one of the best tips for the shoes of your choice. This is a classic fashion type that many women follow. One of the best tricks to look good is to combine any of your outfits and accessories. However, it is more than twice a single color.
· Always buy shoes according to your body characteristics. The flat shoes look good only on thin women. The little ladies can choose shoes with high heels. The shoes are elongated. Berrylook has different types of shoes for women.
· Complete your outfit.
Women's shoes online are just a click away.

MattBurditt1
Reviewed by MattBurditt1 on
,
How can you find comfortable and stylish women's shoes online?
How can you find comfortable and stylish women's shoes online?

How can you choose the perfect pair of shoes?
Choosing the perfect pair of shoes can be a bit tricky. There are different types of styles and colors for women's shoes. Different heel heights are also available in these shoes. For every outfit, a matching shoe must be worn to achieve a complete look. If you are looking for footwear that fits the casual outfits, you can opt for ankle boots and canvas shoes
Rating: 5

Javascript – Collision Detection Problem on Canvas Platformer

I'm having big problems with collision detection in my platformer. If you go straight to the right, the block floats. Even the corners let the block through and the walls are sticky. It's a bit chaotic. I know that my gravity is a big problem. If someone could help me, I would be so happy.

Here is the collision code:


  
  
  
  const calculatorTileSize = 1.0 / mapTileSize;
const nextX = guy.x + guy.velX;
const nextY = guy.y + guy.velY;


const currentMinX = (guy.x * calculatorTileSize) | 0;
const currentMaxX = ((guy.x + guy.width) * calculatorTileSize) | 0;
const currentMinY = (guy.y * calculatorTileSize) | 0;
const currentMaxY = ((guy.y + guy.height) * calculatorTileSize) | 0;

const nextMinX = (nextX * calculatorTileSize) | 0;
const nextMaxX = ((nextX + guy.width) * calculatorTileSize) | 0;
const nextMinY = (nextY * calculatorTileSize) | 0;
const nextMaxY = ((nextY + guy.height) * calculatorTileSize) | 0;


// Collision of the X-axis
if (guy.velX! == 0.0) {
for (if i = nextMinX; i <= nextMaxX; i ++) {
for (let j = currentMyY; j <= currentMaxY; j ++) {
if (map[j][i]) {
guy.velX = 0.0;
break;
}
}
}
}

// collision of the Y-axis
if (guy.velY! == 0.0) {
for (if j = nextMinY; j <= nextMaxY; j ++) {
for (let i = currentMinX; i <= currentMaxX; i ++) {
if (map[j][i]) {
guy.velY = 0.0;
physics.gravity = 0;
} else {
Physics.Gravity = 0.4;
}
}
}
}

The full game is in this codeepen:

https://codepen.io/charlie1172/pen/OeGdvJ

Unit – Relative vertical alignment of 3 texts on canvas

This looks like a simple application of anchor properties in the UI layout system:

Animation showing the configuration of three lines in the Unity editor

For all three lines, Min X and 0, and Max X should be 1 so that the anchors span the entire width of the container.

Then vary the Min & Max Y of each element. The bottom line ranges from 0 to 0.3333, the middle from .3333 to .6666 and the top from .6666 to one.

Set the Left Up Right Down parameters to zero so that the corners of the text area align exactly with the anchor points and you are done.

Since the anchors are specified as a fraction of the size of the parent, the layout of the text automatically adjusts as you resize the parent to maintain those relationships.

Animation that shows how to change the size and aspect ratio of the container

If you do not want to change these percentages each time you add or remove an item from your list, you can easily nest it in a parent with a vertical layout group that does the positioning and resizing for you:

Inspector configuration of the vertical layout group