Jump to content

in editor lua, check if "game" started?


Andy Gilbert
 Share

Recommended Posts

Hi, im just playing with lua inside the editor and as for a basic example, if i write a script that uses the update function to rotate an object on an axis it will do this instantly regardless if the "game" is running or not, how can i check if the game is running in the editor?

 

Thanks

Andy

The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do.

 

Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d

Link to comment
Share on other sites

One way to do this is shown in my Pi-Main http://www.leadwerks.com/werkspace/files/file/72-pi-main-v01/ This basically creates a variable in the main script that you can check against in your model scripts. I'm sure there are other ways to do this also. Perhaps checking if fw is nil or not as I seem to recall that variable doesn't get created until the main game script runs?

 

 

But I do agree it would have been nice if there were 2 separate Updates() that we could work with or something along that line to separate from design mode vs run-time mode.

Link to comment
Share on other sites

Thanks Rick, will give that a go. Just thinking ahead, what happens once i press "play" and i have scripted objects to move around? I guess when i press stop they wont return to thier original state?

 

Thanks

Andy

The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do.

 

Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...