init: initializr base code
This commit is contained in:
		
							parent
							
								
									82699642ca
								
							
						
					
					
						commit
						869ba41f13
					
				|  | @ -1,6 +1,6 @@ | ||||||
| 
 | 
 | ||||||
| import Game from "./Wolfie2D/Loop/Game"; | import Game from "./Wolfie2D/Loop/Game"; | ||||||
| import default_scene from "./default_scene"; | import MainMenu from "./shattered_sword/Scenes/MainMenu"; | ||||||
| 
 | 
 | ||||||
| // The main function is your entrypoint into Wolfie2D. Specify your first scene and any options here.
 | // The main function is your entrypoint into Wolfie2D. Specify your first scene and any options here.
 | ||||||
| (function main(){ | (function main(){ | ||||||
|  | @ -11,13 +11,15 @@ import default_scene from "./default_scene"; | ||||||
|     let options = { |     let options = { | ||||||
|         canvasSize: {x: 1200, y: 800},          // The size of the game
 |         canvasSize: {x: 1200, y: 800},          // The size of the game
 | ||||||
|         clearColor: {r: 0, g: 0, b: 0},   // The color the game clears to
 |         clearColor: {r: 0, g: 0, b: 0},   // The color the game clears to
 | ||||||
|  |         useWebGL: false,                        // Tell the game we want to use webgl
 | ||||||
|  |         showDebug: true                       // Whether to show debug messages. You can change this to true if you want
 | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     // Create a game with the options specified
 |     // Create a game with the options specified
 | ||||||
|     const game = new Game(options); |     const game = new Game(options); | ||||||
| 
 | 
 | ||||||
|     // Start our game
 |     // Start our game
 | ||||||
|     game.start(default_scene, {}); |     game.start(MainMenu, {}); | ||||||
| })(); | })(); | ||||||
| 
 | 
 | ||||||
| function runTests(){}; | function runTests(){}; | ||||||
							
								
								
									
										26
									
								
								src/shattered_sword/InputWrapper.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								src/shattered_sword/InputWrapper.ts
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,26 @@ | ||||||
|  | import Input from "./../Wolfie2D/Input/Input"; | ||||||
|  | 
 | ||||||
|  | export default class InputWrapper { | ||||||
|  |     private static isInStoryMode: boolean; | ||||||
|  | 
 | ||||||
|  |     constructor() { | ||||||
|  |         InputWrapper.isInStoryMode = false; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  | 	 * Returns whether or not the attack key is currently pressed | ||||||
|  | 	 * @returns True if the attack key is pressed, false otherwise | ||||||
|  | 	 */ | ||||||
|  |     static isAttackJustPressed(): boolean { | ||||||
|  |         if (InputWrapper.isInStoryMode) { | ||||||
|  |             return false; | ||||||
|  |         } | ||||||
|  |         // TODO
 | ||||||
|  |         return undefined; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     static setStoryMode(storyMode: boolean): void { | ||||||
|  |         InputWrapper.isInStoryMode = storyMode; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
							
								
								
									
										61
									
								
								src/shattered_sword/Player/PlayerController.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								src/shattered_sword/Player/PlayerController.ts
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,61 @@ | ||||||
|  | import StateMachineAI from "../../Wolfie2D/AI/StateMachineAI"; | ||||||
|  | import GameNode, { TweenableProperties } from "../../Wolfie2D/Nodes/GameNode"; | ||||||
|  | import Vec2 from "../../Wolfie2D/DataTypes/Vec2"; | ||||||
|  | import Sprite from "../../Wolfie2D/Nodes/Sprites/Sprite"; | ||||||
|  | import OrthogonalTilemap from "../../Wolfie2D/Nodes/Tilemaps/OrthogonalTilemap"; | ||||||
|  | 
 | ||||||
|  | export enum BuffType { | ||||||
|  |     ATK = "attack", | ||||||
|  |     DEF = "defence" | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | type Buff = { | ||||||
|  |     "type": BuffType, | ||||||
|  |     "value": number, | ||||||
|  |     "bonus": boolean, | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | type Buffs = [ | ||||||
|  |     Buff, Buff, Buff | ||||||
|  | ] | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | export default class PlayerController extends StateMachineAI { | ||||||
|  |     protected owner: GameNode; | ||||||
|  |     MAX_SPEED: number = 300; | ||||||
|  |     BASE_HP: number = 100; | ||||||
|  |     MAX_HP: number = 100; | ||||||
|  |     CURRENT_HP: number = 100; | ||||||
|  |     BASE_ATK: number = 100; | ||||||
|  |     MAX_ATK: number = 100; | ||||||
|  |     CURRENT_ATK: number = 100; | ||||||
|  |     BASE_DEF: number = 100; | ||||||
|  |     MAX_DEF: number = 100; | ||||||
|  |     CURRENT_DEF: number = 100; | ||||||
|  | 
 | ||||||
|  |     CURRENT_BUFFS: { | ||||||
|  |         atk: 0; | ||||||
|  |         hp: 0; | ||||||
|  |         def: 0; | ||||||
|  |         speed: 0; | ||||||
|  |     } | ||||||
|  |     velocity: Vec2 = Vec2.ZERO; | ||||||
|  |     tilemap: OrthogonalTilemap; | ||||||
|  | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * Returns three legal random generate buffs based on current state | ||||||
|  | 	 * @returns Three buffs | ||||||
|  | 	 */ | ||||||
|  |     static getBuffs(): Buffs { | ||||||
|  |         // TODO
 | ||||||
|  |         return undefined; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  | 	 * Add given buff to the player | ||||||
|  | 	 * @param buff Given buff | ||||||
|  | 	 */ | ||||||
|  |     setBuff(buff: Buff): void { | ||||||
|  |         // TODO
 | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										5
									
								
								src/shattered_sword/Scenes/Levels.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								src/shattered_sword/Scenes/Levels.ts
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | ||||||
|  | import Scene from "../../Wolfie2D/Scene/Scene"; | ||||||
|  | 
 | ||||||
|  | export default class Levels extends Scene { | ||||||
|  |     // TODO
 | ||||||
|  | } | ||||||
							
								
								
									
										5
									
								
								src/shattered_sword/Scenes/MainMenu.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								src/shattered_sword/Scenes/MainMenu.ts
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | ||||||
|  | import Scene from "../../Wolfie2D/Scene/Scene"; | ||||||
|  | 
 | ||||||
|  | export default class MainMenu extends Scene { | ||||||
|  |     // TODO
 | ||||||
|  | } | ||||||
							
								
								
									
										5
									
								
								src/shattered_sword/Scenes/StoryMode.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								src/shattered_sword/Scenes/StoryMode.ts
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | ||||||
|  | import Scene from "../../Wolfie2D/Scene/Scene"; | ||||||
|  | 
 | ||||||
|  | export default class StoryMode extends Scene { | ||||||
|  |     // TODO
 | ||||||
|  | } | ||||||
							
								
								
									
										13
									
								
								src/shattered_sword/sword_enums.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								src/shattered_sword/sword_enums.ts
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,13 @@ | ||||||
|  | export enum Player_Events { | ||||||
|  |     PLAYER_MOVE = "PlayerMove", | ||||||
|  |     PLAYER_JUMP = "PlayerJump", | ||||||
|  |     PLAYER_ATTACK = "PlayerAttack", | ||||||
|  |     PLAYER_DASH = "PlayerDash", | ||||||
|  |     PLAYER_HEAL = "PlayerHeal", | ||||||
|  |     PLAYER_KILLED = "PlayerKilled", | ||||||
|  | } | ||||||
|  | export enum Damage_Type { | ||||||
|  |     NORMAL_DAMAGE = "NormalDamage", | ||||||
|  |     ENVIRONMENT_DAMAGE = "EnvironmentDamage", | ||||||
|  |     DOT_DAMAGE = "DOTDamage", | ||||||
|  | } | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user