How do I create an object such as a wall in javascript? - javascript

I am programming a game in JavaScript, the game involves player one controlling an image of a head around the screen by using the arrows on the keyboard. The aim is to get as much burgers shown on the screen. Once you get it, it will randomly appear somewhere else on the screen. My first problem is how do i create an obstacle such as a wall in JavaScript? my second problem is how do i create a rule that result's in game over if the obstacle is touched?

It is easy to solve by using box2D, and I use the framework which integrates box2D.
this is the example link I did 2 mins ago:game link
if you don't know how to use it,my facebook messenger is Alan Nie

Related

How to add a feature to GO JS floorplanner sample?

I'm currently building a GO JS floor planner based on this sample (https://gojs.net/latest/projects/floorplanner/FloorPlanner.html). When the user places walls and they connect to each other, I want to make a room out of the four walls. I want to fill out the area that was shaped by the 4 walls. I know this is in the second-floor planner but I just want to add this feature to the old one and I don't know TypeScript. Can someone help me, how should I do it?

Creating MMO using canvas

So I will be using javacript and HTML to create a game in canvas in my planning stage however I started to wonder how I was gonna handle multiple users editing and playing on the same "canvas" per say
So to describe my issue I wanna tell you a little about the game
When I was 7(now 18) I played this amazing game called "Pocket Empires" it brought Teamwork to a whole new playing field it had everything you see in the modern day "Clash of Clans" but while in battle if you were struggling your alliance members could jump in the battle and save you
It was truly a remarkable game I encourage everyone to look it up
This game however was android only and fell through the cracks in 2013 and I have looked for a game clone since but have found nothing truly like it since so now I am going to create it myself
The main thing about the game I am concerned with is displaying the same thing across all screens for example
Player 1 places a building
Player 2 should see that on his screen
or
Player 1 is attacking some goblins
Player 2(if in the same alliance) should see player 1 attacking and should be able to join in
I have done a lot of research over the years I have a web development certificate in both HTML and CSS(as if that actually mattered) Afterwards I spent another 2 years learning Javacript and PHP
Now I know php will not be of use without ajax which I want to avoid at all cost so thats all the information I believe I can provide now I leave it to y'all to lead me in the right direction
You can use web sockets to :
send the action of the user to the server
get the actions of others player and to show what needs to

Communicate between two Adobe AIR windows

I am building an Adobe AIR (HTML/JavaScript) app for a client who wants to display a game interface on two screens. One screen is where the user will interact with the game itself, the other screen (shown on a projector) will show the game to an audience. The contents of screen 2 is NOT the same as screen 1, so it's NOT a case of mirroring.
An example of this, is a bingo game where the user will click buttons on screen 1 to pull out numbers, etc. And screen 2 will just show the number grid and next number pulled out to the audience who are playing the game. So you can imagine this in a hall of people, with screen 1 being displayed to the guy on stage, and screen 2 being projected to everyone else in the hall. So screen 2 has no interaction and ONLY displays data.
How would I handle this? As I need to be able to send commands to the other window to make it show numbers, update the number grid, etc.
I've looked at doing something like:
projectorWindow.setWindowReference(air.NativeApplication.nativeApplication.openedWindows[1].stage.getChildAt(0).window);
projectorWindow.sendNumber( 88 );
But does anyone have a better idea? Existing examples of doing this?
Second question:
Also in order to make the windows know what each is talking about, I presume I will have to load the EXACT same code into each one so basically load a HTML file like: Bingo.html and then pass a query string to tell it what mode to run in... e.g. Bingo.html?mode=user and Bingo.html?mode=audience does that sound right? Or would there be a better way to do this?
So for example:
function loadGame(game) {
mainWindow.load(new air.URLRequest(game + '.html?mode=user'));
projectorWindow.load(new air.URLRequest(game + '.html?mode=audience'));
}
Not quite sure how I'll trigger the different UI elements based on the query string yet... but is this the best way to build a split screen game using AIR? Or could I do it better?

Animate 2D Human body Skeletal using JS

I want to create a 2D skeletal animation using JavaScript library to make interactive 2D animations in the browser.
I'd like to create a human body. Let's consider this simple scenario to better explain what I want to achieve. I have a text box where I can enter an instruction like "say Hi", then the body should raise a hand up and give hi five. I am working to draw the both images and make them show up at every time.
When Init() : I show the body (Image One)
When I request to say Hi : I show the next body taking the hands up (Image two)
And I do animation by creating a HTML5 canvas, the same way as: http://jsfiddle.net/FZyA3/
The problem is that I have to make more than 50 instructions. It's heavy to draw all the scenarios where I have common cases. Is there any open source character to use, like Three.js and babylon.js?
Is there any other better solution, like pixelising the arm and making it movable within an HTML5 canvas?
I highly recommand spine: http://esotericsoftware.com/
It's an editor which comes with an JS-runtime.

Stacking images vs slides

So I'm working an a little game that is online. It's a probability game and I'd like to have a few slides that have information and then the actual game. I'm using html & javascript to make the game and then css (which I don't know yet) to make it look better.
How would I go about creating different pages, should I just have an image and then make it opaque when I don't need it and then show another one over it?
The reason I'm asking is because I'm sure there is a much better way to do this but don't know how because I'm new to web coding.
you can make two separated pages.
contain the images one after another .. first image will have JS onclick .. on this function you will hide this image and show the other image
second image will be treated like link to the game page.

Categories