R0J0hound's Recent Forum Activity

  • Here's an example for an 8 direction grid movement:

    http://dl.dropbox.com/u/5426011/examples2/8dirGrid.cap

    made in 0.99.94

    I haven't used XAudio2 much but autoplay works fine the first time with any other wav file I've used. For a fix for that particular file throw in an event like this:

    + System: TickCount Lower than 3
    -> XAudio2: Autoplay file "C:\Documents and Settings\Rhino\My Documents\Downloads\Amaranthine\Amaranthine\Sounds\tick.wav" (No loop)[/code:3dghcu4n]
    and the tick will play the first time you hit a key.
    
    In the last problem the reason it's not working is arrays are 1 based.  (1,0,0) doesn't exist so no value is getting set,  change it to (1,1,1).
    
    -cheers
  • One way to do it without plug-ins would be to give objects A and B two private variables each, storing their angle and distance from object C. Then just update A and B's position and angle every frame relative to object C.

    Here's an example of that and mouse rotation:

    http://dl.dropbox.com/u/5426011/examples2/AttachObjectExample.cap

    made in 0.99.94

  • It's a valid question, setting and getting .xy in python is incomplete and doesn't work. You can only set and get x and y individually.

    -cheers

  • Here's an example of isometric sorting like the filmation engine. It can sort isometric blocks of any size (length, width and depth) and should be flicker free. There is only one situation where sorting fails, but that can be avoided with level design.

    The graphics are from this free sprite library:http://planar-studios.com/?nav=2&view=niilulib

    Download:

    http://dl.dropbox.com/u/5426011/examples/iso2.cap

    made in 0.99.93

  • In a nutshell

    "Sprite" is a list of all the sprite instances.

    "SOL.Sprite" is a list of all the picked sprite instances.

    The reason "System.Create()" picks only the new object is because that's what happens in events.

    Here's an example:

    http://dl.dropbox.com/u/5426011/examples/pythonSOL.cap

  • SOL stands for "selected object list" and it allows you to access the objects picked via events. When an object is created it becomes the only picked object of that type. Also the created object will not be accessible via "Sprite[index]" until the next frame.

    Say there are no instances of the "Sprite" object.

    System.Create('Sprite', 1, 45, 45)
    Sprite.x=22   #this will cause an index error[/code:25n0pb6b]
    [code:25n0pb6b]System.Create('Sprite', 1, 45, 45)
    SOL.Sprite.x=22   #this will work[/code:25n0pb6b]
    
    Your example will create 10 sprites and move the first 10 sprites not the created ones.
    
    Ideally new objects are modified right after each are created.  You can however create multiple objects save their references and modify them later.
    [code:25n0pb6b]import random
    newObjs=[]
    
    for x in range(10):
       System.CreateByName("spr", 1, random.randint(10,400), random.randint(10,400))
       newObjs.append(SOL.spr[0])
    
    for obj in newObjs:
        obj.X = random.randint(10,400)
        obj.Y = random.randint(10,400)[/code:25n0pb6b]
    
    [quote:25n0pb6b]Is there a len() operator of any fashion?
    
    len(Sprite) returns the number of Sprite objects excluding objects created that frame.
    len(SOL.Sprite) returns the number of picked Sprite objects.  It will return 1 after a sprite object is created.
  • Welcome to the forms. Both those functions are just wrappings of their event counterparts, which create new instances of the specified object. Are you getting the error "NameError: name 'SpawnObject' is not defined"? If so, then you're calling SpawnObject wrong.

    Examples of usage.

    System.Create('Sprite2', 1, Sprite.X, Sprite.Y)[/code:9dbub4pk]
    will do the same thing as
    [code:9dbub4pk]Sprite.SpawnObject('Sprite2', 1, 0)[/code:9dbub4pk]
    
    -cheers
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No python install is necessary. No crash will occur if you use some python at least at the start of the layout to initialize python. If python isn't initialized the app will crash if ~ 700 objects are created (it's a bug). This bug shouldn't be a problem as long as some python scripts are used when scripting is enabled.

  • [quote:l5bph80r]Any idea how to get it in the actual game?

    It's incomplete. While you can design the menus, you can't display them. Also the system menu conditions are not implemented in the runtime.

    You can make your own menus with events or if you know how to with the Windows api in C you could make a plugin.

    There are are a few examples of event made context menus here: http://www.scirra.com/forum/viewtopic.php?f=3&t=6688&hilit=context+menu.

  • Luomu, that will work no problem. Also you can eliminate the "objref" variable and do it directly:

    System.Create('Sprite', 1, 0, 0)
    SOL.Sprite.x =300[/code:32mlmfm3]
  • After all the Sprite objects are destroyed python will give an error because there is no object to access.

    Change the code to check if there are objects to access:

    if len(Sprite) > 0:
       if Sprite.Value('av')<= 995:
          Sprite.SetValue('av',Sprite.Value('av')+5)[/code:pgglqjf1]
  • With the the latest version of Construct(0.99.93) you can reference a newly created object in python like so:

    System.Create('Sprite',1,0,0)
    objRef=SOL.Sprite  #this gets the reference of the new Sprite. 
    
    objRef.x=400
    objRef.y=300
    objRef.angle=30
    objRef.skewy=20[/code:27wv8267]
R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 155 followers

Connect with R0J0hound