R0J0hound's Recent Forum Activity

  • If a Sprite has the Platform movement then it's done like this:

    SpritePlatform.IsOnGround()[/code:31kd3wv5]
    
    I recommend trying out Silent Cacophony's [url=http://www.scirra.com/forum/viewtopic.php?f=16&t=6158&start=0&hilit=pyshell]Pyshell[/url] for experimenting with python.  I use it whenever I use python in my caps to see the correct name of attributes and to see what's accessible.
    
    To find the names of all the attributes of SpritePlatform:
    * Open PyShell.cap
    * Add a Sprite object and give it a Platform Movement.
    * Run the cap
    * Type in "dir(SpritePlatform)" and press enter.
    
    -cheers
  • No, it's not possible in python. The "Solid" attribute can be added at runtime with events or python but it can't be removed.

  • Try this it will eliminate the teleport.

    + DirectionBlock: Value 'Direction' Equal to 0
    
       + MouseKeyboard: On key Right arrow pressed
       + playerCol: overlaps DirectionBlock : offset (10,0)
       |  -> DirectionBlock: Set collision mode to None
       |
       + MouseKeyboard: On key Left arrow pressed
       |  -> DirectionBlock: Set collision mode to Per Pixel
       |
       |  + playerCol: playerCol overlaps DirectionBlock
          |  -> DirectionBlock: Set collision mode to None
    [/code:1kvgwug0]
  • In Construct Random(2) will return 0 or 1, but not 2.

    A way that's simpler than checking for overlap at offset, just check for overlap. If it's true, undo the last movement and rotate 90 or -90.

    + Ghost: Ghost overlaps Wall
    -> Ghost: Move 0-Ghost[Bullet].Speed*TimeDelta pixels at Ghost.Angle degrees
    -> Ghost: Rotate {90,-90} @ (Random(2)+1) degrees clockwise
    [/code:33czl20k]
  • object2 should be in quotes:

    object1.Overlaps("object2")[/code:2x3quw2v]
    but that, although correct, causes construct to crash.
    
    Use OverlapsOffset instead:
    [code:2x3quw2v]if object1.OverlapsOffset("object2",0,0):
       Text.Text = "True"
    else:
       Text.Text = "False"[/code:2x3quw2v]
  • 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
  • Try Construct 3

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

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

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 155 followers

Connect with R0J0hound