R0J0hound's Forum Posts

  • From what I can tell the body is moved around directly and everything else: eyes, arms and legs point toward some target positions. I don't really see any physics other than the jump.

    This tutorial is relevant for the arms and legs I suppose. It's for construct classic but it explains it well, and all of it could be done in C2.

  • Physics engines usually do no conserve energy, there is loss over time. The reason is everything is an approximation. You can however keep the energy close to being constant by correcting the velocity.

    So the equation is this:

    E=KE+PE

    E=0.5*m*v^2 + m*g*h

    solved for v

    v = sqrt((E-mgh)*2/m)

    So the events to correct the velocity so energy is conserved would be:

    global number total_energy=0

    global number initial_y=0

    global number speed=0

    global number angleOfMotion=0

    Start of layout

    --- set initial_y to ball.y

    --- set total_energy to ball.physics.mass*10*(480-ball.y)

    ball: y<initial_y

    --- ball: set y to initial_y

    every tick

    --- set speed to sqrt((total_energy-ball.physics.mass*10*(480-ball.y))*2/ball.physics.mass)

    --- set angleOfMotion to angle(0,0,ball.physics.velocityX,ball.physics.velocityY)

    --- ball: physics: set velocity to ( speed*cos(angleOfMotion), speed*sin(angleOfMotion) )

  • Those text adventure creation tools likely implement a lot of the things you'd need for you, so that indeed would be the easiest. Apart from that you can make a text adventure in pretty much any programming language/tool under the sun as long as it lets you use text.

    As far as creating a text adventure the steps are:

    1. creating a way to parse or understand what the player inputted.

    2. using variables and such to define the current game state.

    3. just use a bunch of conditions to do stuff like: if the player types A, and the game state is in B then do C

    For 1 that capx is one possible solution. You can go as complicated as you like here.

    With two you can do absolutely anything. One idea that appeals to me here is to use sprites and stuff to lay everything out. You can then make them all invisible when you run the game. An inventory can be done with a dictionary I'd imagine.

    Three is just a lot of busy work as you should consider all cases.

    The process would be similar with any other tool/language unless they have something specific to text adventures that could make things simpler.

  • Kat Editor

    I don't know why it happens, it seems to be off and on again issue when saving, although I've never had an issue myself. The best you can do is make periodic backups of your project so if it does get corrupted you won't be at a complete loss.

  • No, those are just expressions used in C2. You don't use JavaScript unless you are making plugins.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If your lists are large it makes no difference. You can set the text variables in the same way, but it may not look the cleanest with the event view. Another way is to have the lists in a text file included in the files folder of your project, and loading it with the Ajax object.

    The only complicated looking thing is the tokenat and tokencount expressions but the manual explains them.

  • Each condition filters the objects so I think if you add a "pick all" between each condition it should work. The object that "pick all" should use is the one the Sprite is overlapping with.

  • Another way would be to put the lists into text variables. Then use another variable to store a random value from 0 to 1, and if it's lower than 0.3 set the text to a random value from the first list, or if it's greater then that's the other 70%, so the other list would be used.

    Global text group1="cats,dogs,humans"
    Global text group2="cheese,meat,drinks"
    Global number probability=0
    
    Every 10 seconds
    --- set probability to random(1)
         probability<0.3
         --- set text to tokenat(group1, int(random(tokencount(group1, ","))), ",")
         Else
         --- set text to tokenat(group2, int(random(tokencount(group2, ","))), ",")[/code:2y22kkf8]
  • You could do it just as you describe without the pathfinder.

    Give the player sprite two variables: currentTarget=0 and goalTarget=0

    Then give the square sprite one variable: targetId and number each instance, starting with 0, in the direction the board goes.

    So the setup would be the player is placed on square 0. Then your events would look like this to move the player 5 spaces for example.

    On start of layout

    --- player: add 5 to goalTarget

    player: currentTarget < self.goalTarget

    square: targetId = player.currentTarget+1

    --- player: set angle toward position (square.x, square.y)

    --- player: move forward 100*dt pixels

    player: is overlapping square

    player: currentTarget < self.goalTarget

    square: targetId = player.currentTarget+1

    --- player: add 1 to currentTarget

    I didn't take into account wrapping around the board or centering on the square but it's got the general idea.

  • I'm not clear on what you're doing, but I think your formulas are off.

    If you're just moving with events and the joystick directly controls the speed do this:

    vx=Gamepad.Axis(0,0) * MaxSpeed
    vy=Gamepad.Axis(0,1) * MaxSpeed
    
    x= x+vx*dt
    y= y+vy*dt[/code:vtyzv8xa]
    
    If instead you want some acceleration when using the joystick do this:
    [code:vtyzv8xa]vx = vx + Gamepad.Axis(0,0) * acceleration*dt
    vy = vy + Gamepad.Axis(0,1) * acceleration*dt
    
    x= x+vx*dt
    y= y+vy*dt[/code:vtyzv8xa]
    
    or if you also want a max speed do this:
    [code:vtyzv8xa]vx = vx + Gamepad.Axis(0,0) * acceleration*dt
    vy = vy + Gamepad.Axis(0,1) * acceleration*dt
    
    speed = distance(0,0,vx,vy)
    
    if speed > maxSpeed
    {
    vx = vx*maxSpeed/speed
    vy = vy*maxSpeed/speed
    }
    
    x= x+vx*dt
    y= y+vy*dt[/code:vtyzv8xa]
  • [quote:2djp2t0v]I didn't use paster before. How much would it effect the performance?

    It's just drawing to a texture instead of the screen so it would be equivalent to drawing lots of sprites, or in the case of the example, 30.

  • Ah. I forgot to read the initial posting time.

  • To do that you just need to pick the other block to swap with. This is where the family comes in so you can pick two separate instances of the block. Basically create a family, call it "other" and add the block type to it. So for example if you wanted the block you click on to swap with the block to the right you could do this:

    global number tempx=0

    global number tempy=0

    on right clicked on block

    other: x = block,x+32

    other: y = block.y

    --- set tempx to block.x

    --- set tempy to block.y

    --- block: set position to (other.x, other.y)

    --- other: set position to (tempx, tempy)

  • I wouldn't download that dll. It's core to the windows operating system, if it's crashing then something is very wrong with your system. Have you tried upgrading your graphics card driver?