How to increment an object property, later i check it and disable itself if date/year mismatches

by user83242   Last Updated July 17, 2017 10:15 AM

I'm writing some code,to get the year, then check it during my load screen. If it's not 2017,I want the game object to destroy itself.. it will be a version of the game I give to friends for testing..So next year when I'm hopefully selling the game, it wont work for these test builds. Here's my code,somethings wrong, I usually don't code in python. I thought this would work. The object has an int property called dateok. It has another sensor to check dateok and destroy itself if the value is 1;

import datetime
import bge

cont = bge.logic.getCurrentController()

def main():

if day.year!=2017:

    owner = cont.owner
    dateok = cont.actuators['dateok']
    value = value.get(dateok.propname) +1
    dateok.value = str(value)
    cont.activate(dateok)


Related Questions


BGE Object List within a specified distance

Updated August 14, 2017 12:15 PM



BGUI activate next TextInput wiget on enter key

Updated March 27, 2015 07:05 AM

Smooth Player Movement?

Updated April 03, 2015 21:23 PM