R0J0hound's Recent Forum Activity

  • You can access values from the array object from python with something like Array(2,1,1).

  • You'll have to do your own particles with a sprite object to do that.

  • [quote:14olccbt]1. What is _Instances?

    It's basically just to hide\organize instance classes from the main global dict. It should never need to be accessed directly. Basically every object type causes 2 classes to be generated ex. Sprite and SpriteInstance. SpriteInstance is a class that points to a particular instance of sprite.

    [quote:14olccbt]2. Will objA[0].Destroy() call objAInstance.Destroy()? Is objAInstance the class of objA[0]?

    es for the first. For the second objA[0] is a objAInstance.

    The only issue is if you destroy the object with events, the python destroy() is not called and the custom methods will not be cleaned up.

  • 1. Is there a way to get the array indices for the list of Sprite (instances of the object Sprite) in the SOL?

    Not directly, but you can use UID to find identical objects:

    index=0
    for i,obj in enumerate(Sprite):
        if obj.uid==SOL.Sprite.uid:
            index=i
            break[/code:2el5nzri]
    
    [quote:2el5nzri]2. Will those indices always be the same if I create and destroy Sprites the same way? 
    
    The indices will be the same until any of that object type is destroyed, in which case the order will be scrambled a bit.
  • [quote:2py1z69r]What's different between "objA._value" and "objA[0]._value" in this case?

    objA is the class to access objA instances and exists for the duration of the application. objA[0] creates a temporary class to access that instance.

    Here is a fix:

    Add this code to 'Start of Layout' before you run any other code to be able to attach new members to instances.

    class _instance_values:
    	pass
    
    _Instances._vals_=dict()
    for _ot in _Instances.__dict__.items():
    	if _ot[0][0]=='_':
    		continue
    	_ot[1]._oldgetattr=_ot[1].__getattr__
    	def mygetattr(this, attr):
    		objkey=this.__dict__['__instance__']
    		if _Instances._vals_.has_key(objkey):
    			if hasattr(_Instances._vals_[objkey],attr):
    				return getattr(_Instances._vals_[objkey],attr)
    		return this._oldgetattr(attr)
    	_ot[1].__getattr__=mygetattr
    	
    	_ot[1]._oldsetattr=_ot[1].__setattr__
    	def mysetattr(this, attr, value):
    		objkey=this.__dict__['__instance__']
    		if not _Instances._vals_.has_key(objkey):
    			_Instances._vals_[objkey]=_instance_values()
    		if not hasattr(this.__class__, attr) and attr not in this.__class__._otherAttrib:
    				return setattr(_Instances._vals_[objkey], attr, value)
    		return this._oldsetattr(attr,value)
    	_ot[1].__setattr__=mysetattr[/code:2py1z69r]
  • With the wait object it's a bug.

  • Are you using the OR condition at all in layout 3?

  • Do something like this:

    import random
    random.choice(Sprite).angle+=1[/code:2q52df0n]
    
    When using python you can't pick objects like with conditions.  You'll have to use traditional programming to do it.  You can however access what objects are selected by events with SOL.Sprite.
  • Well, it appears that looplength just returns the end number of the loop. Loopindex will return the currently processed loop number.

    ex:

    for 1 to 5

    1,2,3,4,5

    for 1 to -2

    1,0,-1,-2

    for 0 to 3

    0,1,2,3

  • [quote:1bw51e8y]Shouldn't he just be using time delta?

    If he wants to. That is another way to achieve the same result.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Construct uses the vs2005 runtime because it was compiled with Visual Studio 2005. This does not make it outdated since Microsoft still supports it releasing security fixes and patches for it on a regular basis.

    When installing construct the latest version of the vc2005 runtime is installed. This is the version used, which was released 4/11/2011, much newer than MSXML 4.0 SP3 which was released 9/29/2009.

    Are you sure that security vulnerability is still current? The date on the page you linked to dates from 2008.

  • The wait object breaks picking with multiple instances. Use the timer behavior instead.

    http://dl.dropbox.com/u/5426011/examples5/timerEx.cap

    made in cc1.2

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 155 followers

Connect with R0J0hound