R0J0hound's Recent Forum Activity

  • You could try this:

    every tick:

    ----scroll x to player.x

    player y > scrolly + 100:

    ----scroll y to scrolly + 100*dt

    player y < scrolly - 100:

    ----scroll y to scrolly - 100*dt

    The numbers may need some tweaking, but that makes the screen scroll when the player goes 100 pixels from the center of the screen, so you essentially get a dead zone where no vertical scrolling occurs.

    Another approach that doesn't have a dead zone, but is less jarring than scollto, is to always scroll toward the player at a speed proportional to the distance the player is from the center of the screen.

    every tick:

    ----scroll to position: scrollx+(player.X-scrollx)*2*dt, scrolly+ (player.Y-scrolly)*2*dt

    The numbers can be tweaked to adjust the responsiveness. As it is now it will scroll to exactly where the player is in half a second if the player is not moving.

  • Try using the "Path" object. It's "Path.AppData" expression should give you that folder.

  • You're welcome. I sent you the file via PM.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There was some php text in the middle of your cap. It only affected the event sheets and was able to recover 98 of the 125 event sheets. I'd recommend running checkdisk or some other file system checker on your hard drive to ensure it's integrity.

  • It works for me.

    I'm using python 2.6.4 but the latest 2.6.x version should work.

    I uncommented "//#define python" from stdafx.h and built DX9_p.exe and DX9.exe.

    I then renamed them to DX9_ps.exe and DX9_s.exe.

    Then with scripting enabled in Construct I was able to both preview and export with no issues.

    If you build the non python runtimes are you able to preview and export cap files with scripting disabled?

  • The sand blocks do have gravity, but to speed things up only the sand blocks around the player are moved.

  • I was able to make a good speed up by using an array to store the UIDs of the Blocks at each grid position. That allows for direct selection of a block at any grid position. With that it eliminated the need for a detection sprite since with the array it's simple to select one grid below.

    I also removed the platform behavior and used events to take advantage of using an array.

    http://dl.dropbox.com/u/5426011/examples7/MineGenner.capx

    A final optimization could be to only have block objects on screen exist to reduce the total object count.

  • Here's an updated python file:

    http://dl.dropbox.com/u/5426011/utility/capreader.py

    It wasn't saving long text correctly.

    If it still isn't working post the cap and I can fix it and my script.

  • Here's a way to do it using a detector sprite.

    http://dl.dropbox.com/u/5426011/c2/simpleboxdrop.capx

    In contrast Construct Classic makes this is easy to do with one event and no detector sprite.

    + System: For each Block ordered by Block.Y Descending

    + Block: [negated] Block: overlaps "Solid" : offset (0,1)

    -> Block: Set Y to Block.Y+1

    Hopefully those features will make their way into C2.

  • You can get rid of the white lines by making the collision polygon a bit smaller.

  • Here's good python reference that I use all the time that is easier use than the official docs.

    http://www.tutorialspoint.com/python/

    Here's my working of the problem.

    from random import random,randint
    from math import sin,cos
    
    def SpawnNearPlayer(objectName, layer, rangeMin, rangeMax):
       # calculate random polar coordinate.
       random_angle = random()*360 
       random_distance = randint(rangeMin,rangeMax)
       
       # calulate x,y from angle and distance from Player.
       x = random_distance * cos(random_angle) + Player.X
       y = random_distance * sin(random_angle) + Player.Y
       
       #check to see if x,y will be on the layout
       if 0 <= x <= System.LayoutWidth and 0 <= y <= System.LayoutHeight:
          #Yes. create the object
          System.Create(objectName, layer, x, y)
       else:
          #No.  Try a different point.
          SpawnNearPlayer(objectName, layer, rangeMin, rangeMax)

    I eliminated the __class__.__name__ bit as it looks too cluttered. You now pass the object's name to begin with instead of the object type.

    So instead of calling the function like this:

    SpawnNearPlayer(Sprite,1, 50,100)

    Do this (notice the quotes):

    SpawnNearPlayer('Sprite',1, 50,100)
  • SullyTheStrange

    The platform needs to be moved vertically after the player is moved.

    Move the "Plat: Set Y to self.Y+self.MoveY*dt" from event 9 and put it in a new "Every tick" event at the bottom of the event sheet. You'll also want to reposition mario to the player sprite in that event otherwise mario will appear to lag behind.

    Ketoulou

    The key to get it to work is moving the platform after the player.

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 155 followers

Connect with R0J0hound