nutmix's Forum Posts

  • Hi, usually I stick with arial and verdana, and use normal text objects in the game. I avoid sprite fonts etc as I am guessing they will increase the game size and decrease performance, two things I I cant do.

    A customer is requiring me to use a new font, the dubiously named "VAGRoundedBT".

    What will happen on mobile devices such as iphones and Android hand sets?

    How do I distribute this font?

    Shoud I be using web fonts, or sprite fonts, or are they the same thing?

    Thanks!

  • Hi, I have a large background image for my main game.

    I want the same background image on the loader layout.

    however, in the loader layout view, I cant access the objects which were in the main game layout. If I add the background image sprite, will the game bundle it up and download it twice? If so, can this be avoided?

    Thanks for your help.

  • OK, sussed it. The correct format is:

    "{

        ""c2array"": true,

        ""size"": [75,1,1],

        ""data"":[[[""na""]],[[""st""]],[[""nd""]],[[""rd""]],[[""th""]]]

    }"

    Doesn't seem logical, but I guess thats JS for you!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • From various posts, I have guessed at the JSON format required to load an array.

    Its for looking up the "th" string, e.g.

    "1" & array.at(1)

    should result in "1st" etc.

    I tried loading it with this string:

    "{

        ""c2array"": true,

        ""size"": [75,0,0],

        ""data"":[1:""st"",2:""nd"",3:""rd"",4:""th""]

    }"

    I also tried this:

    "{

        ""c2array"": true,

        ""size"": [75,1,1],

        ""data"":[[[1:""st"",2:""nd"",3:""rd"",4:""th""]]]

    }"

    and this:

    "{

        ""c2array"": true,

        ""size"": [75,1,1],

        ""data"":[[[""na"",""st"",""nd"",""rd"",""th""]]]

    }"

    and a million other formats.

    The ones which dont throw a runtime error, all print "10", i.e. they get back zero from the array.

    Anyone know the required JSON format to load an array (or dictionary).

    Thanks!

  • I have read the container manual page, but i am struggling to get them to work.

    Firstly, I don't get if I am supposed to take the container object, and add its sub objects, or take each sub object, and add the container object.

    Currently I am doing both, so if A contains B, I add B as the container for A, and A as the container for B. If I only do one, I get unpredictable results.

    What objects are containers? Can any object be a container?

    If I want to take a large group of sub objects which together make up one complete object, can i use containers to only have to anchor one object, rather than individually anchor them all? Previously I did this with pinning, but as pinning can only be set at run time, I end up with lots of code like:

    pin B to A

    pin C to A

    pin D to A

    Etc. Shame this cant be done in the designer.

    What else do containers give you?

    Currently I only know one thing: if you create the container, it creates the sub objects.

    If you select one of the sub object, I could not get it to also select the container, so I use instance variables called MYID, and assign both container and containee the same instance Var at run time. This works, and allows me to select one when the other is selected. Are containers supposed to help with this?

  • LittleStain

    good exmaple. Do you have to destroy the template object like this? I havent done this, which could be why in your third action its affecting mutliple sprites. Or perhaps because my equivalent of Sprite3 is in a family with lots of other copies of Sprite3?

  • This does not seem to work for me. If I create a new ball object for example, then use ball.xx in the action of the same or a sub event, it always acts on all balls, not the one I just created.   As I don't know how to pick the event I just created, I actually do this:

    1) have he ball on a special layer, called "templates"

    2) have a blank layer called "new"

    3) create a new "ball" object on layer "new".

    4) use an event condition where I say ball.isOnLayer("new")

    5) then in the events actions, do this: ball.setLayer("target")

  • This does not seem to work for me. If I create a new ball object for example, then use ball.xx in the action of the same or a sub event, it always acts on all balls, not the one I just created.   As I don't know how to pick the event I just created, I actually do this:

    1) have he ball on a special layer, called "templates"

    2) have a blank layer called "new"

    3) create a new "ball" object on layer "new".

    4) use an event condition where I say ball.isOnLayer("new")

    5) then in the events actions, do this: ball.setLayer("target")

    This seems to work.

  • Ok, my solution did not work. I have tried the following:

    1) Spawning a copy of an existing (off layout) ball object, then using ball->set x etc. in actions in the same event block. This moves all balls, not the one just created.

    1) assigning a intance variable called "justCreated" and set it to 0. Use System->create object to create a new ball. In a sub event, select ball where justCreated = 0, and set it to 1. Do stuff to that ball. This doesnt work as it affects the newly created ball, AND the template/dummy ball which is only there to allow new balls to be created.

    Can anyone point me to a man page, thread, or capx which shows how to pick the object you just created/spawned?

    Thanks!

  • Perfect! Ill stick with that then - nice.

    Thanks!

  • Er, if you cant create then pick, what is the recommended solution? Create, wait, then pick? That would seem tricky?

  • If I want to create a ball, then do stuff with it (e.g. move it around), that's easy. But If I want to create an instance of say a blue, black or red ball, then do the same stuff with which ever one I just created?

    E.g. inn bingo, the balls are different colours depending on the number just called.

    E.g. if the number is between 1 and 15, create a blue ball

    if the number is between 16 and 30, create a green ball.

    Then I want to do a whole lot of stuff with that ball. But I dont want to have to duplicate all that code for each ball colour, and I dont think you can pass balls (objects) in as parameters to a function.

    I actually solved the problem by making the balls different frames of a single sprite, but I'm interested if there is another way for cases where the sprite hack would not have worked?

    Many thanks for your thoughts.

  • Ha, so it will always be slightly longer than 1s, so it will accumulate a positive error over time.

    I assume I need to do something different, e.g. get the timestamp of now, then check every tick if the current time stamp is >= 1s different, then 2s differnt etc. This will not have the accumulative error.

    Looks like System.wallclocktime might be what i need? Im hoping this is similar to the unix timestamp in ms.

  • Is this event approximate, or fairly accurate? What I mean by that is that assuming the game is running at full speed (60fps?),

    1) would the timer be accurate to within miliseconds?

    2) would errors accumulate? Or if the system was busy of 2X seconds, would the event fire twice in quick succession, and "catchup" afterwards?

    3) If you say ran "every 1 second" say 1000 times (i.e. let the event fire 1000 times), would the elapsed time be 1000s +/- <1s?

    Thanks!

  • Wow, I had no idea you could legitimately use a blank sub event, I thought they were just temp placeholders for pasting in real sub event code.

    Great, that works!