Yann's Forum Posts

  • I'm working (well... I should be working) on my paid job.

    But as I'll use 8 direction and mouse in my c2 contest game I will probably have to find a solution.

  • Oh I see... Indeed really weird. It almost look like a focus issue.

    Like when you click the focus of the webpage is recalculated and in this time the arrow input are ignored... maybe...

  • zenox > it's an ergonomy problem then. But I don't think the "global" option should be disable. For one reason: it could be used effectively we just never encounter a case where it was.

    The more option the better, even if confusion can arise. People will ask, and learn some concept through design mistake.

  • There's not, you don't even want to use physics for that kind of stuff.

    If you have a start point and an end point you just want to calculate a curve.

    Physic is usefull if you want a movement to be the consequence of environnemental factor (gravity, wind, friction) Thus you can't really predict movement, and you don't really want to.

    The behavior you describe is really not physics driven.

    Indeed what squid showed is a curve calculation you can use the bullet behavior and tweak angle/speed during movement

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • How it was used in Mina's capx is not a proper use of global object. Global object shouldn't even be used for Graphical representation.

    The only things that should be global are data you want to keep through layouts (score/lives/position/etc)

    I used to use Global object in cc to avoid updating sprites in each layout each time I change things.

    But now Sprite instance even if not global share the same Object Definition in the Object library (Texture, variables, behavior, etc). So if you want to change animation or instance variable definition for the whole project, you can change on the instance and it will be changed for all layout even if it's not global.

    I can't really figure out why making graphical element global.

  • Please see this tutorial

    Cleaner

  • It really depends on your overall gameplay. There's no such thing as an univeral AI tutorial. Just some pointers and example. But you seem to have reach a state where you already have a working AI you just don't manage find the proper balance (that's what I understood reading you).

    So basically you should share your capx to have some input that fits your game. If you don't want to share all your work, try too replicate your basic mecanism in another capx and share it.

  • that's weird. I posted it 'cause I tested it with chrome and there wasn't any bug.

  • hmmm With your waypoint detector system (the orange sprites) you just have to compare laps and waypoint. But indeed you can't easily evaluate pixel by pixel when a car goes in front of another one. As in a race the space continuum is bent by the shape of the track.

    BUT that does not explain why you use different object for NPC.

    If you want different name, just use a variable with the name of the NPC

    If you want different speed parameter, you can tweak each instance

    If you want to count the number of lap or current waypoint for each NPC, just create an instance variable which will old the count for each.

    This way you can calculate position easily :

    NPC: X greater than FinishLine.X
    NPC: is overlapping FinishLine
       -> NPC: set backward to true
    NPC: X less than FinishLine.X
    NPC: is overlapping FinishLine
    NPC: [INVERT] is backward
       -> NPC: set crossing to true
    NPC: [INVERT] is overlapping FinishLine
        NPC: is crossing
           -> NPC: add 1 to lap
        Every tick
           -> NPC: set crossing to false
           -> NPC: set backward to false

    backward booleans are use to check if things goes in the right direction when you cross the finish line.

    For waypoint you will just have to check

    NPC is overlapping waypoint
       -> NPC: set trackPosition to waypoint ID

    Then you can calculate relative position with this formula:

    Every tick
        -> NPC: set racePosition to NPC.lap*waypoint.Count+NPC.trackPosition

    if your NPC crossed the line 3 times and is at the 5th waypoint and you have 20 waypoint, his position will be:

    3*20+5 = 65

    Then you just have to go through all your NPC to check position.

    Unfortunately we still don't have a foreach ordered by.

    So you will have to do a for loop between 0 and the max number of possible lap*number of waypoint.

    For instance if you have a race which last nbLap laps

    Global variable inc=1
    for 0 to nbLap*Waypoint.Count
        Local variable check=0
        NPC: racePosition equal loopindex
            -> NPC: set place to inc
            -> System: set check to 1
        Player: racePoistion equal loopindex
            -> Player: set place to inc
            -> System: set check to 1
        System: check equal 1
            -> System: add 1 to inc

    This assume you run the same kind of calculation for the player object.

    Which makes me think that you could also have the player object be the same as the other NPC but just deactivate NPCs by using a boolean you set in property panel.

    NPC: is Player
      -> activate the race behavior
      -> deactivate the bullet behavior
    NPC: [INVERT] is Player
      -> activate the bullet behavior
      -> deactivate the race behavior
      -> run the AI

    This way you can really have less event to maintain

    (Of course if there were families... You could just put NPC and Player into the same family and run all the above stuff just for the family)

  • Oh! well it's not really a problem is it?

    You just have to duplicate the object and change its text with event as you still have the value in the global variables.

    minaPlatform.capx

  • and what about the second capx? with simulated control?

  • minaPlatform.capx

    Just cleaned things up and explain the Global variable concept in comment.

  • like that?

    rollRoll.capx

  • Don't understand why you have 3 NPC object instead of 3 instances of the same object

    Forgot to ask last time I saw your capx

  • 1) assuming the pivot is in the center of the sprite

    foreach Sprite
    Sprite.X >= LayoutWidth-Sprite.Width/2
        -> Sprite: set touchBoundary to true
        -> Sprite: set yStart to Sprite.Y

    yStart is an instance variable

           

    2)

    Global variable yPixels = 100
    Sprite: Y position is lower than Sprite.yStart+yPixels
    Sprite: is touchBoundary
        -> Sprite: set Y to Sprite.Y+50*dt

    will move the sprite by 100px down at 50px/sec

    3) how do you move them to left in the first place?

    I think you can achieve this effect with the canvas, by pasting your shield on start of frame, and then pasting a destination out blowing sprite on top of it to erase them.