- Code: Select all
function onKeyDown( key )
if(key=="y") then
entity.setRotation( entity.getEntityIDFromTag("pla"), 7, 3, 2 )
end
end
when you press the "Y", the object is to rotate. But he only turns once.
function onKeyDown( key )
if(key=="y") then
entity.setRotation( entity.getEntityIDFromTag("pla"), 7, 3, 2 )
end
end
function onKeyDown( key )
if(key=="y") then
entity.roll( entity.getEntityIDFromTag("pla"), 1, 1 )
end
end
but I can look at making a turn(r,p,y) function to give accumulative roll, pitch, yaw in one function if you need this.
entity.move(objectID,0,0,1)
entity.translate(objectID,0,0,1)
MoveEntity(entity,x,y,z)
TranslateEntity(entity,x,y,z)
function onUpdate()
entity. move(1,0,0)
end
function onKeyDown( key )
end
function onKeyDown( key )
sky.lprint("Key = "..key); -- any key will cause this line to be called
if(key=="p") then
sky.lprint("You pressed the P Key!"); -- only the "p" key will call this line.
end
end
function object:Update()
if KeyDown(KEY_UP) ==1 then
cube:Movef(0,0,1) -- cube moves when you press the "UP"
end
end
function onUpdate( timeDelta )
if( moveFlagX == 1) then entity.move(obj,-0.001,0,0) end
if( moveFlagY == 1) then entity.move(obj,0.001,0,0) end
end
function onKeyDown( key )
if(key=="z") then moveFlagX = 1 end
if(key=="x") then moveFlagY = 1 end
end
function onKeyUp( key )
if(key=="z") then moveFlagX = 0 end
if(key=="x") then moveFlagY = 0 end
end
function onUpdate( timeDelta )
if( input.keyDown( "z" ) == 1) then entity.move(obj,-0.001,0,0); input.releaseKey("x"); end
if( input.keyDown( "x" ) == 1) then entity.move(obj,0.001,0,0); input.releaseKey("z"); end
end
Users browsing this forum: No registered users and 3 guests