diff --git a/Client/export/windows/cpp/bin/SkullRush.exe b/Client/export/windows/cpp/bin/SkullRush.exe index 5b2d4d0..49c4eee 100644 Binary files a/Client/export/windows/cpp/bin/SkullRush.exe and b/Client/export/windows/cpp/bin/SkullRush.exe differ diff --git a/Client/source/PlayState.hx b/Client/source/PlayState.hx index 52a5c37..0d69c76 100644 --- a/Client/source/PlayState.hx +++ b/Client/source/PlayState.hx @@ -59,6 +59,7 @@ class PlayState extends FlxState public var m:Mutex; public var wepHUD:WeaponHUD; + public var wepBar:WeaponBar; /** * Function that is called up when to state is created to set it up. @@ -123,7 +124,9 @@ class PlayState extends FlxState } wepHUD = new WeaponHUD(2); - add(wepHUD); + hud.add(wepHUD); + //wepBar = new WeaponBar(2); + //hud.add(wepBar); Assets.initAssets(); Thread.create(thread); diff --git a/Client/source/Player.hx b/Client/source/Player.hx index 5dffa24..9fce65c 100644 --- a/Client/source/Player.hx +++ b/Client/source/Player.hx @@ -1,6 +1,7 @@ package ; import flixel.util.FlxSpriteUtil; import ext.FlxWeaponExt; +import flixel.util.FlxTimer; /** * ... @@ -8,14 +9,22 @@ import ext.FlxWeaponExt; */ class Player extends PlayerBase { - //public var requestShoot:Bool = false; - public function new(Id:Int, Name:String, X:Int, Y:Int) { super(Id, Name, X, Y); setGun(1); } + override public function fire():Void + { + super.fire(); + + var reload:FlxTimer = new FlxTimer(last_shot.mock_fireRate / 1000); + Reg.state.wepBar.setRange(0, 1); + Reg.state.wepBar.setParent(reload, "progress", false); + trace(last_shot.mock_fireRate); + } + override public function setGun(GunID:Int, Force:Bool = false):Void { if (Std.is(GunID, Int)) diff --git a/Client/source/SkullClient.hx b/Client/source/SkullClient.hx index 702b540..9409efc 100644 --- a/Client/source/SkullClient.hx +++ b/Client/source/SkullClient.hx @@ -609,6 +609,11 @@ class SkullClient extends Client NWeapon.setUpWeapons(p); p.setGun(1); } + + Reg.state.wepBar = new WeaponBar(0, Std.int(Reg.state.wepHUD.height - WeaponHUD.PADDING)); + Reg.state.hud.add(Reg.state.wepBar); + Reg.state.wepBar.y = Reg.state.wepHUD.y - 1; + Reg.state.wepBar.x = Reg.state.wepHUD.x + Reg.state.wepHUD.width; } if (MsgID == Msg.GrantGun.ID) diff --git a/Client/source/WeaponBar.hx b/Client/source/WeaponBar.hx new file mode 100644 index 0000000..051b21b --- /dev/null +++ b/Client/source/WeaponBar.hx @@ -0,0 +1,27 @@ +package ; +import flixel.ui.FlxBar; +import flixel.util.FlxSpriteUtil; + +/** + * ... + * @author Ohmnivore + */ +class WeaponBar extends FlxBar +{ + + public function new(X:Float = 0, Height:Int = 100) + { + super(X, 0, FlxBar.FILL_VERTICAL_INSIDE_OUT, 10, Height, null, "", 0, 2000, true); + + scrollFactor.set(); + createFilledBar(0xff005100, 0xff00F400, true, 0xff000000); + + centerY(); + } + + public function centerY():Void + { + FlxSpriteUtil.screenCenter(this, false, true); + } + +} \ No newline at end of file diff --git a/Client/source/WeaponHUD.hx b/Client/source/WeaponHUD.hx index b2e0ca5..c1a30e7 100644 --- a/Client/source/WeaponHUD.hx +++ b/Client/source/WeaponHUD.hx @@ -3,6 +3,7 @@ import flixel.FlxSprite; import flixel.group.FlxGroup; import flixel.group.FlxSpriteGroup; import flixel.text.FlxText; +import flixel.ui.FlxBar; import flixel.util.FlxSpriteUtil; /** @@ -19,7 +20,7 @@ class WeaponHUD extends FlxSpriteGroup private var selector:FlxSprite; - public function new(X:Float) + public function new(X:Float = 0) { super(X, 0); scrollFactor.set(); @@ -61,7 +62,6 @@ class WeaponHUD extends FlxSpriteGroup hiders.set(Slot, hider); background.makeGraphic(Std.int(width), Std.int(height - PADDING), 0x99000000); - FlxSpriteUtil.screenCenter(this, false, true); } diff --git a/Client/source/networkobj/NWeapon.hx b/Client/source/networkobj/NWeapon.hx index b24047b..85c2abe 100644 --- a/Client/source/networkobj/NWeapon.hx +++ b/Client/source/networkobj/NWeapon.hx @@ -36,6 +36,7 @@ class NWeapon public var shotsToFire:Int = 1; public var spread:Int = 0; public var ignoreCollisions:Bool = false; + public var mock_fireRate:Int = 0; public var TRAIL_EMITTER:Int; public var TRAIL_EMITTER_GRAPHIC:String; @@ -46,7 +47,7 @@ class NWeapon bulletLifeSpan = Arr[1]; bulletSpeed = Arr[2]; fireRate = Std.int(Arr[3] / 2); - //trace(fireRate); + mock_fireRate = Arr[3]; name = Arr[4]; bulletGraphic = Arr[5]; gunGraphic = Arr[6]; @@ -109,6 +110,7 @@ class NWeapon w.shotsToFire = shotsToFire; w.spread = spread; w.setFireRate(fireRate); + w.mock_fireRate = mock_fireRate; w.makeImageBullet(10, Assets.images.get(bulletGraphic), Std.int(bulletOffset.x), Std.int(bulletOffset.y), false, 180); diff --git a/Shared/code/ext/FlxWeaponExt.hx b/Shared/code/ext/FlxWeaponExt.hx index 7aa05c6..537941e 100644 --- a/Shared/code/ext/FlxWeaponExt.hx +++ b/Shared/code/ext/FlxWeaponExt.hx @@ -23,6 +23,8 @@ class FlxWeaponExt extends FlxWeapon public var inheritance:FlxPoint; + public var mock_fireRate:Int; + public function new(Name:String, ?ParentRef:FlxSprite, ?BulletType:Class, ?BulletID:Int = 0) { super(Name, ParentRef, BulletType, BulletID);