Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // SparkedJs (Beta 2) :: "Game/Game Support.js"
- function mapDisplay ( ) {
- for(let index = 0; index < Maps.length; index++){
- switch(player.map){
- case index:
- Maps[index].canvas.style.visibility = `visible`;
- break;
- default:
- Maps[index].canvas.style.visibility = `hidden`;
- break;
- }
- }
- }
- function flipBuffers ( ) {
- FrontBuffer.canvas.width = window.innerWidth;
- FrontBuffer.canvas.height = window.innerHeight;
- FrontBuffer.canvas.style.width = `${window.innerWidth}px`;
- FrontBuffer.canvas.style.height = `${window.innerHeight}px`;
- FrontBuffer.context.clearRect(
- 0,
- 0,
- FrontBuffer.canvas.width,
- FrontBuffer.canvas.height
- );
- FrontBuffer.context.drawImage(
- BackBuffer.canvas,
- 0,
- 0,
- BackBuffer.canvas.width,
- BackBuffer.canvas.height,
- 0,
- 0,
- FrontBuffer.canvas.width,
- FrontBuffer.canvas.height
- );
- }
- function resetTitle ( title = `SPARKED!` ) {
- let temp = ``;
- for(let offset = 0; offset < title.length; offset++){
- temp += (temp?` `:``)+title[offset];
- }
- return temp;
- }
- function createBuffers ( ) {
- BackBuffer.canvas = createCanvas ({
- name: null,
- zIndex: 0,
- visibility: `hidden`,
- position: `absolute`,
- width: 320,
- height: 200,
- left: 0,
- top: 0,
- listen: false
- });
- BackBuffer.context = BackBuffer.canvas.getContext(`2d`);
- FrontBuffer.canvas = createCanvas ({
- name: null,
- zIndex: 0,
- visibility: `visibile`,
- position: `absolute`,
- width: 320,
- height: 200,
- left: 0,
- top: 0,
- listen: false
- });
- FrontBuffer.context = BackBuffer.canvas.getContext(`2d`);
- flipBuffers ( ) ;
- }
- function resetplayer ( ) {
- return {
- map: 0,
- sprite: 0,
- x: 1,
- y: 1,
- tank: 10,
- bomb: 0,
- shield: 0
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement