Hi all, Working on a mod, trying to make it so when you turn left the sprite changes facing left. Alternatively I could make it flip (But I don't know how). Here is my animation LUA: Code: { "animatedParts" : { "stateTypes" : { "boosting" : { "default" : "off", "states" : { "off" : { }, "on" : { "properties" : { "persistentSound" : "/sfx/tech/hover.wav" } } } } }, "parts" : { "bubble" : { "rightState" : { "boosting" : { "on" : { "properties" : { "centered" : true, "image" : "right_board.png" } } } }, "leftState" : { "boosting" : { "on" : { "properties" : { "centered" : true, "image" : "left_board.png" } } } } } } } } When I'm in game, the sprite doesn't appear. However this does: Code: { "animatedParts" : { "stateTypes" : { "boosting" : { "default" : "off", "states" : { "off" : { }, "on" : { "properties" : { "persistentSound" : "/sfx/tech/hover.wav" } } } } }, "parts" : { "bubble" : { "partStates" : { "boosting" : { "on" : { "properties" : { "centered" : true, "image" : "board.png" } } } } } } } } I do have the images in the right locations. Any help would be Much appreciated
Are you simply using the LUA code for bubble boost/butterfly boost? Have you made any modifications to that?
Yea I have, keep returning errors when i try and make changes. I'm not too knowledgeable on the lib or the language to be honest
Code: function init() data.lastJump = false data.lastBoost = nil data.ranOut = false end function input(args) local currentJump = args.moves["jump"] local currentBoost = nil -- if tech.onGround() then -- Hover on spot if not tech.onGround() then if not tech.canJump() and currentJump and not data.lastJump then if args.moves["right"] and args.moves["up"] then currentBoost = "boostRightUp" elseif args.moves["right"] and args.moves["down"] then currentBoost = "boostRightDown" elseif args.moves["left"] and args.moves["up"] then currentBoost = "boostLeftUp" elseif args.moves["left"] and args.moves["down"] then currentBoost = "boostLeftDown" elseif args.moves["right"] then currentBoost = "boostRight" tech.setAnimationState("rightState", "on") elseif args.moves["down"] then currentBoost = "boostDown" elseif args.moves["left"] then currentBoost = "boostLeft" tech.setAnimationState("leftState", "on") elseif args.moves["up"] then currentBoost = "boostUp" end elseif currentJump and data.lastBoost then currentBoost = data.lastBoost end end data.lastJump = currentJump data.lastBoost = currentBoost return currentBoost end function update(args) local boostControlForce = tech.parameter("boostControlForce") local boostSpeed = tech.parameter("boostSpeed") local energyUsagePerSecond = tech.parameter("energyUsagePerSecond") local energyUsage = energyUsagePerSecond * args.dt if args.availableEnergy < energyUsage then data.ranOut = true elseif tech.onGround() or tech.inLiquid() then data.ranOut = false end local boosting = false local diag = 1 / math.sqrt(2) if not data.ranOut then boosting = true if args.actions["boostRightUp"] then tech.control({boostSpeed * diag, boostSpeed * diag}, boostControlForce, true, true) elseif args.actions["boostRightDown"] then tech.control({boostSpeed * diag, -boostSpeed * diag}, boostControlForce, true, true) elseif args.actions["boostLeftUp"] then tech.control({-boostSpeed * diag, boostSpeed * diag}, boostControlForce, true, true) elseif args.actions["boostLeftDown"] then tech.control({-boostSpeed * diag, -boostSpeed * diag}, boostControlForce, true, true) elseif args.actions["boostRight"] then tech.control({boostSpeed, 0}, boostControlForce, true, true) elseif args.actions["boostDown"] then tech.control({0, -boostSpeed}, boostControlForce, true, true) elseif args.actions["boostLeft"] then tech.control({-boostSpeed, 0}, boostControlForce, true, true) elseif args.actions["boostUp"] then tech.control({0, boostSpeed}, boostControlForce, true, true) else boosting = false end end if boosting then tech.setAnimationState("boosting", "on") return energyUsage else tech.setAnimationState("boosting", "off") return 0 end end Edit: I think this is better? Code: { "animatedParts" : { "stateTypes" : { "boosting" : { "default" : "off", "states" : { "left" : { "properties" : { "centered" : true, "image" : "left_board.png" "persistentSound" : "/sfx/tech/hover.wav" }, "right" : { "properties" : { "centered" : true, "image" : "right_board.png" "persistentSound" : "/sfx/tech/hover.wav" } } } } }, "parts" : { "bubble" : { "rightState" : { "boosting" : { "on" : { "properties" : { "centered" : true, "image" : "right_board.png" } } } }, "leftState" : { "boosting" : { "on" : { "properties" : { "centered" : true, "image" : "left_board.png" } } } } } } } } Code: function init() data.lastJump = false data.lastBoost = nil data.ranOut = false end function input(args) local currentJump = args.moves["jump"] local currentBoost = nil -- if tech.onGround() then -- Hover on spot if not tech.onGround() then if not tech.canJump() and currentJump and not data.lastJump then if args.moves["right"] and args.moves["up"] then currentBoost = "boostRightUp" elseif args.moves["right"] and args.moves["down"] then currentBoost = "boostRightDown" elseif args.moves["left"] and args.moves["up"] then currentBoost = "boostLeftUp" elseif args.moves["left"] and args.moves["down"] then currentBoost = "boostLeftDown" elseif args.moves["right"] then currentBoost = "boostRight" tech.setAnimationState("boosting", "right") elseif args.moves["down"] then currentBoost = "boostDown" elseif args.moves["left"] then currentBoost = "boostLeft" tech.setAnimationState("booting", "left") elseif args.moves["up"] then currentBoost = "boostUp" end elseif currentJump and data.lastBoost then currentBoost = data.lastBoost end end data.lastJump = currentJump data.lastBoost = currentBoost return currentBoost end function update(args) local boostControlForce = tech.parameter("boostControlForce") local boostSpeed = tech.parameter("boostSpeed") local energyUsagePerSecond = tech.parameter("energyUsagePerSecond") local energyUsage = energyUsagePerSecond * args.dt if args.availableEnergy < energyUsage then data.ranOut = true elseif tech.onGround() or tech.inLiquid() then data.ranOut = false end local boosting = false local diag = 1 / math.sqrt(2) if not data.ranOut then boosting = true if args.actions["boostRightUp"] then tech.control({boostSpeed * diag, boostSpeed * diag}, boostControlForce, true, true) elseif args.actions["boostRightDown"] then tech.control({boostSpeed * diag, -boostSpeed * diag}, boostControlForce, true, true) elseif args.actions["boostLeftUp"] then tech.control({-boostSpeed * diag, boostSpeed * diag}, boostControlForce, true, true) elseif args.actions["boostLeftDown"] then tech.control({-boostSpeed * diag, -boostSpeed * diag}, boostControlForce, true, true) elseif args.actions["boostRight"] then tech.control({boostSpeed, 0}, boostControlForce, true, true) elseif args.actions["boostDown"] then tech.control({0, -boostSpeed}, boostControlForce, true, true) elseif args.actions["boostLeft"] then tech.control({-boostSpeed, 0}, boostControlForce, true, true) elseif args.actions["boostUp"] then tech.control({0, boostSpeed}, boostControlForce, true, true) else boosting = false end end if boosting then tech.setAnimationState("boosting", "on") return energyUsage else tech.setAnimationState("boosting", "off") return 0 end end
Okay, so you want the board to switch direction based on which direction you're facing. If I remember correctly, the bubble in butterfly boost already does this. So.. I'd recommend just using all the files for butterfly boost, but instead of bubble.png being in the "parts" section, just replace it with left_board.png (or right_board.png, depending on the direction you want). It should swap properly.
My thought is this: when you use butterfly boost, it makes a bubble around your character, which actually changes direction based on which way the character is facing (it flips horizontally). Do you only want the board to be facing the same direction as the character? Or changing direction based on which way you're boosting?
I want the board to flip with the character I've looked at the bubble thing... I can't see how it changes?
Bump... Would love some help Also Mandrew: Code: "parts" : { "bubble" : { "partStates" : { "boosting" : { "on" : { "properties" : { "centered" : true, "image" : "bubble.png" } } } } } } }, It does look like it turns around
Yea, it doesn't say it does, but try it in game. Look at the little shiny spot in the top corner of it- it should switch based on which way your character is facing. Or go to my tech tutorial and try the bubbleball tech, as that uses the same graphic and it changes. You can see it in the .gif at the end of the tutorial even
I think it might be something to do with orientations: \assets\objects\apex\apexceilingtv.object "inventoryIcon" : "apexceilingtvicon.png", "orientations" : [ { "imageLayers" : [ { "image" : "apexceilingtv.png:<color>.<frame>", "unlit" : true }, { "image" : "apexceilingtvlit.png:<color>.<frame>" } ], "flipImages" : true, "imagePosition" : [-8, -16], "frames" : 14, "animationCycle" : 2.0, "spaceScan" : 0.1, "anchors" : [ "top" ], "direction" : "left", "lightPosition" : [-3, -3] }, { "imageLayers" : [ { "image" : "apexceilingtv.png:<color>.<frame>", "unlit" : true }, { "image" : "apexceilingtvlit.png:<color>.<frame>" } ], "imagePosition" : [-8, -16], "frames" : 14, "animationCycle" : 2.0, "spaceScan" : 0.1, "anchors" : [ "top" ], "direction" : "right", "lightPosition" : [3, -3] } ], "soundEffect" : "/sfx/objects/tv_static.wav", "soundEffectRadius" : 40 } I can't confirm this though.
I've got a sorta similar question, is there any way to make the png a weapon uses change depending on direction the holder is facing? For example, I have a stop sign weapon which reads STOP one way and ꟼOTƧ the other If I could add a second png with the letters drawn backwards and have it flip them back to legibility, that would be quite cool. I mean, it's not a huge deal (the letters are very small after all) but I think it'd be a nice detail if it read correctly both ways.
I think the flip is done in the source code. Since they use sfml and c++ it makes the most sense to load one image and just flip it on the y-axis than loading another texture just for changing directions. Some evidence that supports this theory is that all the hats have two positions: climbing, and everything else. For you, RacieB, short of figuring out how to edit the image itself to produce the desired effect, I don't think it's possible. For you, xtrapsp, I think SuperMandrew is right and it should do it automatically.
I agree that it probably isn't possible without digging into source, but I did notice that at least the vending machine shows some precedent on using different pngs for right/left placement - "orientations" : [ { "leftImage" : "vendingmachineleft.png:default", "rightImage" : "vendingmachineright.png:default", "imagePosition" : [-8, 0], "frames" : 1, "animationCycle" : 0.5, "spaceScan" : 0.1, "anchors" : [ "bottom" ], "collision" : "platform" } Useful for things other than objects such as techs or weapons or armors? I dunno about that, but I thought it was interesting