Merge pull request #582 from craftersshaft/creffyspatches
Added health, setHealth, changeDadCharacter, changeBoyfriendCharacter, keyPressed to modcharting
This commit is contained in:
commit
a4f8096c95
@ -32,6 +32,10 @@ function stepHit (step)
|
|||||||
-- do nothing
|
-- do nothing
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function keyPressed (key)
|
||||||
|
-- do nothing
|
||||||
|
end
|
||||||
|
|
||||||
print("Mod Chart script loaded :)")
|
print("Mod Chart script loaded :)")
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -116,6 +120,7 @@ Current calls to functions include,
|
|||||||
| update | Elapsed frames | Gets called every frame (after the song starts) |
|
| update | Elapsed frames | Gets called every frame (after the song starts) |
|
||||||
| stepHit | Current Step | Gets called when ever a step hits (steps are in between beats, aka 4 steps are in a beat) |
|
| stepHit | Current Step | Gets called when ever a step hits (steps are in between beats, aka 4 steps are in a beat) |
|
||||||
| beatHit | Current Beat | Gets called when ever a beat hits |
|
| beatHit | Current Beat | Gets called when ever a beat hits |
|
||||||
|
| keyPressed | Key Pressed | Gets called when a key just got pressed (up, down, left, right, accept) |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -435,6 +440,13 @@ Smoothly fade in to an alpha
|
|||||||
|
|
||||||
Smoothly fade out to an alpha
|
Smoothly fade out to an alpha
|
||||||
|
|
||||||
|
##### changeBoyfriendCharacter(string id)
|
||||||
|
|
||||||
|
Changes the Boyfriend sprite to another character
|
||||||
|
|
||||||
|
##### changeDadCharacter(string id)
|
||||||
|
|
||||||
|
Changes the Dad sprite to another character
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -232,7 +232,23 @@ class ModchartState
|
|||||||
|
|
||||||
public static var luaSprites:Map<String,FlxSprite> = [];
|
public static var luaSprites:Map<String,FlxSprite> = [];
|
||||||
|
|
||||||
|
function changeDadCharacter(id:String)
|
||||||
|
{ var olddadx = PlayState.dad.x;
|
||||||
|
var olddady = PlayState.dad.y;
|
||||||
|
PlayState.instance.removeObject(PlayState.dad);
|
||||||
|
PlayState.dad = new Character(olddadx, olddady, id);
|
||||||
|
PlayState.instance.addObject(PlayState.dad);
|
||||||
|
PlayState.instance.iconP2.animation.play(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeBoyfriendCharacter(id:String)
|
||||||
|
{ var oldboyfriendx = PlayState.boyfriend.x;
|
||||||
|
var oldboyfriendy = PlayState.boyfriend.y;
|
||||||
|
PlayState.instance.removeObject(PlayState.boyfriend);
|
||||||
|
PlayState.boyfriend = new Boyfriend(oldboyfriendx, oldboyfriendy, id);
|
||||||
|
PlayState.instance.addObject(PlayState.boyfriend);
|
||||||
|
PlayState.instance.iconP2.animation.play(id);
|
||||||
|
}
|
||||||
|
|
||||||
function makeLuaSprite(spritePath:String,toBeCalled:String, drawBehind:Bool)
|
function makeLuaSprite(spritePath:String,toBeCalled:String, drawBehind:Bool)
|
||||||
{
|
{
|
||||||
@ -349,6 +365,10 @@ class ModchartState
|
|||||||
// sprites
|
// sprites
|
||||||
|
|
||||||
Lua_helper.add_callback(lua,"makeSprite", makeLuaSprite);
|
Lua_helper.add_callback(lua,"makeSprite", makeLuaSprite);
|
||||||
|
|
||||||
|
Lua_helper.add_callback(lua,"changeDadCharacter", changeDadCharacter);
|
||||||
|
|
||||||
|
Lua_helper.add_callback(lua,"changeBoyfriendCharacter", changeBoyfriendCharacter);
|
||||||
|
|
||||||
Lua_helper.add_callback(lua,"getProperty", getPropertyByName);
|
Lua_helper.add_callback(lua,"getProperty", getPropertyByName);
|
||||||
|
|
||||||
@ -365,6 +385,10 @@ class ModchartState
|
|||||||
Lua_helper.add_callback(lua,"setHudAngle", function (x:Float) {
|
Lua_helper.add_callback(lua,"setHudAngle", function (x:Float) {
|
||||||
PlayState.instance.camHUD.angle = x;
|
PlayState.instance.camHUD.angle = x;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Lua_helper.add_callback(lua,"setHealth", function (heal:Float) {
|
||||||
|
PlayState.instance.health = heal;
|
||||||
|
});
|
||||||
|
|
||||||
Lua_helper.add_callback(lua,"setHudPosition", function (x:Int, y:Int) {
|
Lua_helper.add_callback(lua,"setHudPosition", function (x:Int, y:Int) {
|
||||||
PlayState.instance.camHUD.x = x;
|
PlayState.instance.camHUD.x = x;
|
||||||
|
@ -143,8 +143,8 @@ class PlayState extends MusicBeatState
|
|||||||
private var generatedMusic:Bool = false;
|
private var generatedMusic:Bool = false;
|
||||||
private var startingSong:Bool = false;
|
private var startingSong:Bool = false;
|
||||||
|
|
||||||
private var iconP1:HealthIcon;
|
public var iconP1:HealthIcon; //making these public for modcharts cause i dont know how else to do it
|
||||||
private var iconP2:HealthIcon;
|
public var iconP2:HealthIcon; //what could go wrong?
|
||||||
public var camHUD:FlxCamera;
|
public var camHUD:FlxCamera;
|
||||||
private var camGame:FlxCamera;
|
private var camGame:FlxCamera;
|
||||||
|
|
||||||
@ -1833,7 +1833,6 @@ class PlayState extends MusicBeatState
|
|||||||
|
|
||||||
if (health > 2)
|
if (health > 2)
|
||||||
health = 2;
|
health = 2;
|
||||||
|
|
||||||
if (healthBar.percent < 20)
|
if (healthBar.percent < 20)
|
||||||
iconP1.animation.curAnim.curFrame = 1;
|
iconP1.animation.curAnim.curFrame = 1;
|
||||||
else
|
else
|
||||||
@ -2826,6 +2825,14 @@ class PlayState extends MusicBeatState
|
|||||||
controls.UP_R,
|
controls.UP_R,
|
||||||
controls.RIGHT_R
|
controls.RIGHT_R
|
||||||
];
|
];
|
||||||
|
#if windows
|
||||||
|
if (luaModchart != null){
|
||||||
|
if (controls.LEFT_P){luaModchart.executeState('keyPressed',["left"]);};
|
||||||
|
if (controls.DOWN_P){luaModchart.executeState('keyPressed',["down"]);};
|
||||||
|
if (controls.UP_P){luaModchart.executeState('keyPressed',["up"]);};
|
||||||
|
if (controls.RIGHT_P){luaModchart.executeState('keyPressed',["right"]);};
|
||||||
|
};
|
||||||
|
#end
|
||||||
|
|
||||||
// Prevent player input if botplay is on
|
// Prevent player input if botplay is on
|
||||||
if(FlxG.save.data.botplay)
|
if(FlxG.save.data.botplay)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user