Yann's Forum Posts

  • Hi,

    I'm using tilebackground a lot these days and almost every time I create a "textureWidth" variable and manually set it.

    I use it for tiledbg-based healthbar and also some kind of infinite background scrolling.

    So the suggestion would be to get this value in expression the same way you have ImageWidth and ImageHeight in the sprite plugin.

    This way if I update the texture and it has another dimension, I don't have to keep track of this variable.

  • Hi, there

    It would be nice that in the "Acquire target" and "Add object to target" action of the turret behavior, we could set an imagepoint to follow.

    Because I have the habit to put the origin of my platformer characters on the bottom, and my shooting enemies are targetting the feet.

    For now, I can probably solve that by adding an object which follows the center of the player and target that object.

    But being able to use the image point would probably be cleaner and make more sense.

  • Ah so the text object isn't the problem here

    Maybe that can help: http://www.w3schools.com/xml/xml_encoding.asp

  • I don't see the problem here

  • thehen

    as a rule of thumb, regex are no good for parsing tree like structures.

    (you'll see a lot of angry answer for parsing xml with regex on stackoverflow :D.. for JSON it's the same idea)

  • I'd say it's not supported.

    But there's a way to fake multidimensionality in dictionary and array

    You can save as a value, the JSON from a dictionary or an array

    For instance

    if I have an array named levels

    and one dictionary per mob in my game (containers) named mobData

    And let say I want to save everything in my level array

    You can do

    system: foreach mobs:
      levels: set value at (level,loopindex) to mobData.AsJson

    And to read this data you just need a temporary dictionary (tmpDict)

    So to get the data of the 3rd mob of level 3 you would do something like:

      tmpDict: Load levels.At(2,2)

    And then you can access any key you want hence faking and array of dictionary. You could have dictionaries of dictionaries of dictionaries, or array of dictionaries of array, any combinaison.

    The only downside is that the JSON is harder to make by hand (multiple level of escaping) and also the access is a bit expensive since you have to load a JSON each time

  • marvek32

    I must admit, I gave up on working on RPGs with C2 for now. To me there's still some feature missing to really handle such game safely (mostly being able to make broad changes without having to edit hundreds of layout one by one)

    Anyhow, what do you mean by preserving the experience? You mean saving and loading data like current level, armor and weapons, event triggered, etc?

  • show the capx and the php file

  • If I load the string I provided directly in C2, it works, though you have to escape " not with \" but with ""

    However since you provide it via php, character escaping shouldn't be too much of an issue (at least on c2 side)

    So what I wonder is, how do you get the data? You're using the AJAX plugin right?

  • Ah ok your format is wrong

    it should be:

    {"c2array":true,"size":[10,3,1],"data":
      [
        [["6"],["Joski"],["3512"]],
        [["4"],["Joski"],["3392"]],
        [["5"],["Joski"],["2538"]],
        [["3"],["Joski"],["1908"]],
        [["1"],["Joski"],["3227"]],
        [["2"],["Joski"],["1333"]]
      ]
    }

    because data should be an is an Array, of 10 Array of 3 array of length 1

    if the dimension where (10,1,1) it would be an array of 10 array of 1 array of length 1

    {"c2array":true,"size":[10,1,1],"data":
      [
        [["6"]],
        [["4"]],
        [["5"]],
        [["3"]],
        [["1"]],
        [["2"]]
      ]
    }

    and if the dimension where something like (10,3,2), it would be an array of 10 array of 3 array of length 2

    {"c2array":true,"size":[10,3,2],"data":
      [
        [["6","7"],["Joski","Smith"],["3512","1337"]],
        [["4","5"],["Joski","Smith"],["3392","1337"]],
        [["5","6"],["Joski","Smith"],["2538","1337"]],
        [["3","4"],["Joski","Smith"],["1908","1337"]],
        [["1","2"],["Joski","Smith"],["3227","1337"]],
        [["2","3"],["Joski","Smith"],["1333","1337"]]
      ]
    }
  • There's a trailing coma... the JSON parser might not like it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • To answser the question of whether or not programming knowledge is required to use C2. You have first to define what programming is.

    If, to you programming is the sum of some obscure syntax and some mathematical formula. I'd say you've got a narrow view of it.

    If you define programming as "a way to tell the computer what to do", then everything you do in your event sheet, is actually, a form of programming.

    And once you learn more common way to program (C, Java, Javascript,...), you will notice that you're just doing exactly the same thing. In programming you have condition, you can make the computer do things (actions) and you definitely use some expression. You can also use loops and function.

    In my opinion (and that's only mine), I don't think that "no programming knowledge required" is really true. I would rather say "no scripting knowledge required" and also "a really fast programming learning curve".

    Because using Construct2, you have under the hood some boilerplate code in the form of the C2 engine itself, some plugins and behaviors that allows you to directly start with the most interesting part: making things move on screen using some inputs.

    If you were to code a game in raw javascript from scratch, and I did, you would have to handle asset loading, collision polygon creation, some way to create levels, and also be careful about browser compatibility and performance.

    Using Construct2, you can just (almost) ignore everything, and get started.

    And because you can directly see results, you learn some programming concepts very fast. Those who learnt programming the hard way had to write awefully boring programs with assignements like:

    "write an isLeapYear function to find if a year is a leap year" or "model a shopping cart" or "write a sorting function to sort numbers in an array" etc.

    Some find that interesting (and I did), but seriously... Learning programming while making your own game is so much more motivating.

    So in conclusion, to me, C2 is programming made accessible for every beginners.

  • psycholize

    You had a pathfinding cell size of 30 whereas your sprites was 16x16 squares.

    And it was possible that the hunter sprite reached its destination node as given by the pathfinder, but somehow was too far to collide with the hunted sprite.

    A clear explanation of why that can happen with a cell size of 30 and a sprite size of 16 would probably require some drawings, and since I'm a bit lazy I'll ask you to trust me on that :D

    All in all, it's probably better to have a cell size of 16 for sprite sizes of 16... (Though it might work with slightly bigger cell size but 30 was too much)

  • Every Tick
       -> Scroll to position Player.X, Player.BBoxBottom - (ViewportBottom(layer) - ViewportTop(layer))/2

    Using ViewportBottom and Top is the only way I found to get the original height of the project's window.

    If you're in any scale mode windowHeight doesn't give you what you need

    The layer should be any layer number or name with a Y parallaxe of 100