Help with your scripting

функция onKeyDown() [DECIDED]

Re: функция onKeyDown() [DECIDED]

Postby StarFire » 09 Nov 2012, 20:27

One more new command:

input.mouseDown(int button)
This returns 1 when the button passed in the argument is held down other wise ti returns 0

Example:
Code: Select all
function onUpdate( timeDelta )
   if( input.mouseDown( 1 ) == 1) then sky.lprint("you pressed the Left mouse button"); end
   if( input.mouseDown( 2 ) == 1) then sky.lprint("you pressed the Right mouse button"); end
end


This will also be in the next release for you ;)
User avatar
StarFire
Skyline Founder
Skyline Founder
 
Posts: 1678
Joined: 03 Jan 2012, 18:50
Location: UK
Skill: Great creative
Skill: Programmer
Skill: 3D Modeller
Skill: 2D Artist
Skill: Level Designer

Re: функция onKeyDown() [DECIDED]

Postby StarFire » 09 Nov 2012, 22:34

and finally 2 more commands:

input.keyHit( String key)
This detects if the specified key has been pressed, if so returns the value 1 then reverts back to 0. This is a one off trigger

input.mouseHit(int button)
This detects if the specified button has been pressed, if so returns the value 1 then reverts back to 0. This is a one off trigger

There is a new page in the API for the new input library : http://www.chi-ad.com/Skyline/API/Lua/h ... input.html

all of these commands will be in the next release for you ; )
User avatar
StarFire
Skyline Founder
Skyline Founder
 
Posts: 1678
Joined: 03 Jan 2012, 18:50
Location: UK
Skill: Great creative
Skill: Programmer
Skill: 3D Modeller
Skill: 2D Artist
Skill: Level Designer

Re: функция onKeyDown() [DECIDED]

Postby ant0N » 10 Nov 2012, 07:07

thank you very much!!! Operative work, guys!
but there are still questions:
how to check the distance between the two objects?
Code: Select all
if EntityDistance(Entity1, Entity2) < 10 then
    -- ....
end


how to check for collisions between objects?
Code: Select all
if EntityCollided(Entity1, Entity2) then
    --...
end
User avatar
ant0N
Skyline Moderator
Skyline Moderator
 
Posts: 415
Joined: 02 Nov 2012, 12:49
Location: Россия, Москва
Skill: Programmer
Skill: 3D Modeller

Re: функция onKeyDown() [DECIDED]

Postby StarFire » 10 Nov 2012, 12:06

Pleased you are happy ; )

antOn: but there are still questions:


Keep them coming ;)

As these are new questions, to keep the information easy to find I have move these two questions to their own post here:

viewtopic.php?f=14&t=64

and

viewtopic.php?f=14&t=65
User avatar
StarFire
Skyline Founder
Skyline Founder
 
Posts: 1678
Joined: 03 Jan 2012, 18:50
Location: UK
Skill: Great creative
Skill: Programmer
Skill: 3D Modeller
Skill: 2D Artist
Skill: Level Designer

Previous

Return to Lua Scripting

Who is online

Users browsing this forum: No registered users and 7 guests

cron