tulamide's Recent Forum Activity

  • If only I could have my beloved preview... <img src="smileys/smiley4.gif" border="0" align="middle" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I don't care what other people qualify a question to, either. If there's a question and I'm able to answer it, I will.

    It isn't as easy as you might think, because you're working with a constantly ticking, parallel processing tool.

    Here is just one example. Keep in mind, there are a couple of other ways to get to the same result, this is just the way I'd do it.

    http://www.mediafire.com/file/jymdjj40y9893ui/npctalking.cap

    (move with arrow keys, interact with space)

  • Sure, why not <img src="smileys/smiley36.gif" border="0" align="middle">

    http://www.mediafire.com/file/f912za7h4cd7eo7/trail.cap

  • Is timer a global variable? Or is it a behavior? Same with timestamp.

    ... you could also use the system expression timer ... timer returns the time passed since start of the game in milliseconds img src="smileys/smiley4.gif" border="0" align="middle">

    But I admit, I wasn't very clear on that.

    Here is the link to the Wiki, btw: Construct Wiki

    Timer: It is a system expression. You access it either by typing "Timer" where needed, or by selecting "Get timer" in the expression wizard of the system object.

    Timestamp: The single quotation marks I used were to indicate that it is a variable. Either global or private - I prefer PV where possible.

    The principle of that method is to get a pointer to a certain time. This can be compared to another time, and if some predefined period has elapsed, you can trigger any other actions you need at that time.

    Calling timer after game ran for 5 seconds:

    timer will return 5000

    Calling timer after game ran for 7 seconds:

    timer will return 7000

    If you use a variable 'timestamp' and fill it once with timer after the game ran for 5 seconds:

    'timestamp' will be filled with timer, and timer returns 5000, so

    'timestamp' = 5000

    If you constantly test against 'timestamp':

    if timer - 2000 = 'timestamp'

    This condition will be true as soon as timer reaches 7000, because 7000 - 2000 = 5000

    Instead of the number 2000, you could use another variable, I called it 'maxTime'. It is the period allowed before the condition will become true:

    if timer - 'maxTime' = 'timestamp'

    Now the problem is, you not just want something to happen after 2 seconds, you also want to inform the player about how many time there is left. That's the third variable 'remaining'. It needs to be set to the difference of 'maxTime' and the current progress within the period. After 0.5s the remaining time is 1.5s, etc:

    set 'remaining' to 'maxTime' - (timer - 'timestamp')

    Let's fill this with values to see how it works. 'timestamp' = 5000, 'maxTime' = 2000.

    We call this action by chance when timer returns 6500, that's 1.5s after we filled 'timestamp':

    set 'remaining' to 2000 - (6500 - 5000) => 2000 - 1500 => 500 or 0.5s

    But 'remaining' will always be calculated, so it can get negative. Imagine we call the action, when timer will return 10000, that's 5 seconds after we filled 'timestamp':

    set 'remaining' to 2000 - (10000 - 5000) => 2000 - 5000 => -3000 or -3s

    We surely don't want that to happen, so we need to catch that before it goes negative:

    'remaining' <= 0

    This condition will be used to trigger any action that makes sense. You could use it to end the game, or you could fill 'timestamp' again with timer, that would reset the timing, so we get a continous loop of a countdown from 2s to 0s, 2s to 0s, ..., or you could switch to another layout. Whatever is needed.

    2)

    So the way I am understanding arrays, they are like grids with values at each of the grid spaces.

    Now, I want a high-score table where people can enter their names, but I don't want something like "type your name here" since that is kind of lame.

    I was wondering, that maybe I can set up an array which has in each space the value for a letter, like A, or H, or a number, 0-9. Stuff like that.

    Of course, I don't know how I'd get that to work, but is it possible?

    I'm sorry but I don't quite understand. Is it the kind of input (name typing, or selecting letters per digit by using up/down/left/right) you are concerned of, or the actual values to store?

    3) Tutorials seem to be split on this- to do a score system, and a high-score system, do you go with arrays, or do you go with INI files (perhaps protected by CRC32), or perhaps some mixture of the two? Whatever is easier is good for me!

    They both are relatively easy. Using ini-files you have all of the informations stored in 1 file, while arrays may use 2,3 or more files, depending on the informations to save, but are more easily sortable. There are two other possibilities: You could also use a hash table.

    Arrays and hash table save their data in a binary format (non human readable), while ini files are simple text files. So you don't really need a crc32 protection for arrays/hashtables.

    Last, but not least you could use 's', a fantastic plugin by lucid. Sorting is easy as well as saving/loading. Plus, all data is not only saved in binary format, but encrypted also, without the need for extra code.

  • YES! Finally!

    Networking with Construct. Hopefully this will become a standard plug for future releases of CC <img src="smileys/smiley4.gif" border="0" align="middle" />

    Can't wait to test it myself. Your work is much appreciated. Thank you.

    (But don't you dare to take a break now <img src="smileys/smiley17.gif" border="0" align="middle" /> )

  • Or, you could always do your own "cone of sight" routine.

    Have a look at the image.

    o = object with cone of sight

    a = angle, to which o faces

    c = the cone of sight

    r = the radius of the cone

    p = sample points within the cone

    d = distance between points on r

    g = distance between points on cone

    All there is to do is creating a virtual cone, and sample only a small subsets of the possible points within the cone (for speed reasons).

    c exists angular, centered around a. The radius is needed and should probably be the border of the visible screen of your game.

    What you need:

    • The height (r) of the cone in pixel => cH
    • The width of the cone in degrees => cA
    • The sample density along r => pH
    • The sample density along the circumference of the cone => pV

    The position of a sample on the virtual grid is

    x = cos( (a - cA / 2) + loop_through_pV * (cA / pV) ) * loop_through_pH * (cH / pH)

    y = sin( (a - cA / 2) + loop_through_pV * (cA / pV) ) * loop_through_pH * (cH / pH)

    Then do whatever suits your needs at that sample point. In my example I did a collision-at-offset check.

    Download coneofview.cap

  • You did a fantastic work, scidave!

    I was especially amazed how smooth it runs. Fast enough for quick shootouts. Very impressive.

    Networking as a plugin, working as in the demo? That would be awesome!

    I really do need to add serialization support to the plugin, but if the performance is pretty decent for folks I think I am just going to release it as an Alpha and take a well deserved break. :-)

    I won't allow you a break until a decent beta is out <img src="smileys/smiley17.gif" border="0" align="middle" />

  • While it played some ogg and wav files, I can't get it to work with mp3. Either complete silence or a short noise sound and then silence, that's all I get. Does it depend on any other library (lame, etc.)?

    EDIT: And what about 'set position' for sounds and peak/rms levels?

  • You can do it this way, without having to destroy anything :

    Combo box

    Hope this works.

    Unfortunately, this does not free the keyboard. (Try adding a sprite with 8-direction to see what I mean). Desroying the combobox seems to be the only way for now.

  • Maybe it doesn't help (may not be passed through Parallels, but what about this?

    https://discussions.apple.com/message/6546084?messageID=6546084#6546084?messageID=6546084

  • Yes, there is a script editor.

    In the event sheet editor right-click on an empty space and select "Insert script". This will open the script editor.

    Scripting must be enabled for Python scripting. If it isn't already (via application properties -> runtime properties -> enable scripting) you will be asked to enable it when selecting "Insert script" for the first time.

    ...And welcome to the forums :)

tulamide's avatar

tulamide

Member since 11 Sep, 2009

Twitter
tulamide has 3 followers

Trophy Case

  • 15-Year Club
  • Coach One of your tutorials has over 1,000 readers
  • Email Verified

Progress

17/44
How to earn trophies