R0J0hound's Forum Posts

  • I'm a little behind with testing c2 releases but I've found an issue. Starting with 38.2 Sprites and TiledBackgound objects are not being drawn in the editor. But they are drawn just fine when running in the browser. Version 37 and earlier worked fine on my system.

    This only occurs on Windows XP with my intel graphics card. My Vista system with an ati graphics card works fine.

    I imagine the issue my be the intel graphics card, which is fairly old. Since 38.2 supports non power of two textures I tried power of two textures to see if maybe the intel chipset doesn't support non power of two, but the textures were still not drawn in the editor.

    Here is my system and graphics card caps if it is helpful: http://dl.dropbox.com/u/5426011/c2/gpu_caps_viewer_report.xml

  • One way you can do it is just by using a whip animation. At the end of the animation check if the end of the whip is colliding with a hook. If it is, disable the current movement scheme and start a pendulum swing. At the end of the swing revert back to the original movement.

    Here is one way to go about it:

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

    made in cc1.2

    If you want a more realistic whip you can try physics objects hinged together:

    http://dl.dropbox.com/u/5426011/example ... dchain.cap

    made in cc1.2

  • System is a bit different since there is only one instance of System.

    get the system class with this:

    System.__class__[/code:29imus8b]
  • Not all objects have an uid attribute, so that could be an issue.

    The best way to get direct access is to just save a reference of that object in a variable.

    Pick the object somehow and save it's reference as 'player'.

    player=SOL.Sprite[0][/code:2rwl2uht]
    
    then after that is you want to access that object just use player:
    [code:2rwl2uht]player.x += 1
    player.angle=45[/code:2rwl2uht]
    
    This will avoid the issue of the index changing.
  • 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?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.