Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

Author Topic: AddScore function...  (Read 2361 times)

0 Members and 1 Guest are viewing this topic.

CMK2901

  • Lurker
  • *
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 35
  • Zoidberg is afoot!
    • View Profile
    • CMK Studios
AddScore function...
« on: January 27, 2007, 01:25:52 AM »

Hi,

I'm implementing a simple scoring feature in the game, but I'm still a bit foggy on how to use your own functions.  I've created a pretty simple function for adding to a score text, but I'm not sure WHERE to put it and HOW to use it.  I tried sticking it in the game.script file and calling it from a scene object script, but it didn't work.  I guess I'm not sure if I have to add an "#include" everywhere I want to use it (a bit tedious) or somehow attach it to a game object...it would be ideal if I could somehow stick the function onto the Game object and just call Game.AddScore() when I need it.  Is this possible?
Logged
CMK Studios
I don't think we're hearing the same voices.

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: AddScore function...
« Reply #1 on: January 27, 2007, 08:53:32 AM »

it would be ideal if I could somehow stick the function onto the Game object and just call Game.AddScore() when I need it. Is this possible?
Yup, you can add new custom methods to any in-game object. All you need to do is add a "method" block to the script attached to that object.

In this case, add something like this to game.script:

Code: [Select]
method AddScore(NumPoints)
{
  // some code here
}
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave
 

Page created in 0.042 seconds with 19 queries.