So. I used the flipv and fliph commands, and they worked! But…i’m using a rectangular hit box that’s for detecting/interacting with other objects when you press Z. The game i’m working on is a top down style RPG, and so i need something along those lines to interact with NPCs, and inspect objects, etc.
But. You remember how i’m trying to flip a rectangle? It works vertically! And Technically works horizontally too. But i want it to flip in such a way that it sticks out from the player in the direction they’re facing. So instead of trying to flip the box, i’m trying to to change it’s dimensions and position when the player uses the arrow keys. I’ve tried a bunch of different ways to get this to work. And i keep getting this error:
ERROR:SCRIPT: My stuff/Player/player-scripts/player interaction.script:1: attempt to call global ‘get_position’ (a nil value)
stack traceback:
My stuff/Player/player-scripts/player interaction.script:1: in main chunk
WARNING:RESOURCE: Unable to create resource: /My stuff/Player/player-scripts/player interaction.scriptc: FORMAT_ERROR
WARNING:RESOURCE: Unable to create resource: /_generated_76a803e.goc: FORMAT_ERROR
ERROR:GAMEOBJECT: Could not instantiate game object from prototype /_generated_76a803e.goc.
WARNING:RESOURCE: Unable to create resource: /main/main.collectionc: FORMAT_ERROR
can someone with more experience help me out please?
Any help, as always is very much appreciated
Here’s the script for reference:
local pos = get_position("player#collisionobject")
local position = vmath.vector3(x, y, z)()
function init(self)
msg.post(".", "acquire_input_focus")
position = vmath.vector3()
end
function on_input(self, action_id, action)
if action_id == hash("up") then
set_position(y,13, x,0.5)
set_rotation(z,0)
elseif action_id == hash("down") then
set_position(y,13, x,0.5)
set_rotation(z,0)
elseif action_id == hash("left") then
set_position(y,13, x,0.5)
set_rotation(z,90)
elseif action_id == hash("right") then
set_position(y,13, x,0.5)
set_rotation(z,90)
end
end