âDuel (a shooter game)â by cristian
https://openprocessing.org/sketch/2489603
License CreativeCommons Attribution ShareAlike
https://creativecommons.org/licenses/by-sa/3.0
{{filePath}}
{{width}} x {{height}}
Report Sketch
Oh, that naughty sketch! Please let us know what the issue is below.
Apply Template
Applying this template will reset your sketch and remove all your changes. Are you sure you would like to continue?
Report Sketch
Report Comment
Please confirm that you would like to report the comment below.
We will review your submission and take any actions necessary per our Community Guidelines. In addition to reporting this comment, you can also block the user to prevent any future interactions.
Please report comments only when necessary. Unnecessary or abusive use of this tool may result in your own account being suspended.
Are you sure you want to delete your sketch?
Any files uploaded will be deleted as well.
Delete Comment?
This will also delete all the replies to this comment.
Delete this tab? Any code in it will be deleted as well.
Select a collection to submit your sketch
We Need Your Support
Since 2008, OpenProcessing has provided tools for creative coders to learn, create, and share over a million open source projects in a friendly environment.
Niche websites like ours need your continued support for future development and maintenance, while keeping it an ad-free platform that respects your data and privacy!
Please consider subscribing below to show your support with a "Plus" badge on your profile and get access to many other features!
Play with keyboard. | Web: https://www.fal-works.com/ | Other game on Steam: https://www.fal-works.com/solid-aether/
A fork of Duel (a shooter game) by FAL
CC Attribution ShareAlike
Duel (a shooter game)
xxxxxxxxxx
// Title: Duel
// Author: FAL ( https://www.fal-works.com/ )
// Made with Processing 3.3.6
/* Change log:
Ver. 0.1 (30. Sep. 2017) First version.
Ver. 0.2 ( 1. Oct. 2017) Bug fix (unintended change of strokeWeight), minor update (enabled to hide instruction window).
Ver. 0.3 (10. Feb. 2018) Minor fix (lack of semicolon).
Ver. 0.4 (12. Feb. 2018) Enabled scaling.
*/
â
/* @pjs font="Lato-Regular.ttf"; */
/*
The font "Lato" is designed by Ćukasz Dziedzic (http://www.latofonts.com/).
This font is licensed under the SIL Open Font License 1.1 (http://scripts.sil.org/OFL).
*/
â
â
// CAUTION: spaghetti code!!!
â
private static final float IDEAL_FRAME_RATE = 60.0;
private static final int INTERNAL_CANVAS_SIDE_LENGTH = 640;
private static final boolean USE_WEB_FONT = false;
â
KeyInput currentKeyInput;
GameSystem system;
PFont smallFont, largeFont;
boolean paused;
â
int canvasSideLength = INTERNAL_CANVAS_SIDE_LENGTH;
float scaleFactor;
â
/* For processing.js
const containerRect = window.document.getElementById("Duel").getBoundingClientRect();
canvasSideLength = min(containerRect.width, containerRect.height);
*/
â
/* For OpenProcessing */
canvasSideLength = min(window.innerWidth, window.innerHeight);
â
/* For Processing Java mode
void settings() {
size(canvasSideLength, canvasSideLength);
}
*/
â
void setup() {
/* For processing.js */
size(canvasSideLength, canvasSideLength);
â
scaleFactor = (float)canvasSideLength / (float)INTERNAL_CANVAS_SIDE_LENGTH;
â
frameRate(IDEAL_FRAME_RATE);
â
// Prepare font
final String fontFilePath = "Lato-Regular.ttf";
final String fontName = "Lato";
smallFont = createFont(USE_WEB_FONT ? fontName : fontFilePath, 20.0, true);
largeFont = createFont(USE_WEB_FONT ? fontName : fontFilePath, 96.0, true);
textFont(largeFont, 96.0);
textAlign(CENTER, CENTER);
â
rectMode(CENTER);
ellipseMode(CENTER);
â
currentKeyInput = new KeyInput();
newGame(true, true); // demo play (computer vs computer), shows instruction window
}
â
void draw() {
background(255.0);
scale(scaleFactor);
system.run();
}
â
void newGame(boolean demo, boolean instruction) {
system = new GameSystem(demo, instruction);
}
â
void mousePressed() {
system.showsInstructionWindow = !system.showsInstructionWindow;
}
See More Shortcuts
Please verify your email to comment
Verify Email