tulamide's Recent Forum Activity

  • If the sprite's name is 'Sprite' and the bullet behavior's name is 'Bullet' then you access the speed property with

    SpriteBullet.Speed = 200[/code:plva6ong]
    
    This is a good thread with some hints to PyShell: [url]http://www.scirra.com/forum/viewtopic.php?f=3&t=7231&p=56896[/url]
  • nice tutorial, I didn't have much time so I just read the Hash Tables part. It would be very helpful if you could show the usage of Hash tables using some construct examples, if you plan to continue this tutorial.

    Thanks

    Thank you for the tut, I didn't have time on the weekend to comment it so I'm doing it now.

    Part 1 to 3 - it's good you're also writing about basics. I've already known the stuff, but I like to refresh my memory and it's good for begginers. There is only one thing, you're using advanced terms in the text. Parsing is one I remember.

    Part 4 - I think I understand it, but not completly. Probably cap would help. Why should I use hash over normal array. In your example I would give every car a private variable and use normal array and than compare it's variable with array's position. I think with hash array I wouldn't need to use that private variable. That would make it easier, but I would like to see it how to it's set up and used.

    Thank you both for commenting. I will try to avoid advanced terms unless I explained them. And I will do an example, comparing arrays to hash tables to show when one or the other makes more sense.

  • Ah yes, this .cap was very useful learning tool, the game itself however is incredibly frustrating... maybe I just have no skill to pay bills.

    Thank you, I'm glad it helped you. For gaming experience: Just tweak it to your likings, change the game layout, alter the formulas to make it less frustrating, etc.

    Happy developing

  • I know what its like to be ignored, but its worse to be misunderstood.

    http://dl.dropbox.com/u/666516/pvsubsubevent.cap

    What I still don't understand is why an object, that obviously exists, at the same time is not pickable. But I will keep my mouth shut

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • [quote:3258oobi]But, well, why can't I access a pv then until the next tick? Doesn't make sense.

    You can, if the action is associated with the object.

    You can do that if its within that particular top tier event, or its subevent.

    Note a top tier event doesn't necessarily have to be the first event.

    A top tier event can be a condition's sub event.

    Its basically the same as the first event if its not associated with a preceding event.

    Does that make sense?

    newt, did you try my example? Because all you say is tested in my example and it does NOT work.

    I, too, know what I am saying, although it seems to be ignored...

  • I do think Ashley said what he said for a reason. Look at this overly simplistic example:

    http://dl.dropbox.com/u/2306601/blinky.cap

    When you press X, a Sprite is being created at the center of the screen. But with the current event order, you won't see anything. It's immediately being destroyed by the second event. However if you switch the event order, the sprite briefly appears before being destroyed. Which means it already existed and could be picked before the next tick - according to my very own logic. Otherwise it shouldn't have blinked when you switch the order. Unless something is going on I'm not getting, which is always a good chance. Still Ashley said what he said!

    Thanks for the example

    I understand the logic and agree with the creation. But, well, why can't I access a pv then until the next tick? Doesn't make sense.

    EDIT: All the top level and subevent explanations, they don't make sense. I was following your logic (that I feel is correct, if I can see the object it must exist) and played around. Now look at this example. The sprite is created in a subevent and immediatly exists - but the pv is not accessible. I get a headache

  • > When you create an object it becomes the only picked object for the remainder of that event. After that the object cannot be picked until the next tick (or frame).

    >

    Is this accurate? I thought it was like this:

    > The way it is, though, is that when you create an object, it doesn't really exist until the end of the next top level event or trigger.

    >

    From my experience, it seems to be like ROJOhound says. You can't, for example, access a pv of a newly created sprite until the next tick. I still think, the object is created at the end of the tick, and all you do in the creation event is just buffered.

  • I would love to see some comments here, although it might seem like something not worth answering.

    I often try to help and invest some time in it. Writing in english makes it even more time consuming. So feedback, if something like that is helpful or not needed, would point me to the right direction.

  • Go to your Mario sprite object's properties and uncheck 'center view on me.'

    That's something I would love to see in MagiCam - overriding all the values/options it uses and/or being relative. For example, a game with nice little zooms here and there to point the player to something special. One would work it out and it would behave just the same, no matter what I set the system zoom to. Would make life easier for games that support different resolutions.

    EDIT: "behave the same" -> I mean the zooming would automatically be relative to the system zoom. Zooming to 150% would not zoom to 150%, but to 150% of the current system zoom.

  • The mechanics and the purpose of variables, arrays and hash tables briefly described:

    http://www.scirra.com/forum/viewtopic.php?f=8&t=8400

  • I hope this overview helps starters understanding some of the logic behind all those terms.

    I. Bits, bytes and memory

    What is this:

    0

    1

    2

    3

    4

    A bunch of numbers, you say? Well, yes, but the computer doesn't care about the type of data, internally everything (a number, a letter, a sound, a color, ...) is represented by switches that have the state 'on' or 'off', and all those switches together are called RAM (Random Access Memory). Such a switch is called a 'bit', and the states are referred to as the bit being set or not set. One bit represents 2 states, which is rather limiting. We could say, that the bit not set stands for the number 0 and the bit set for the number 1. But how would we then represent the number 2 or 3 or 4, etc?

    The answer is: by combining several bits. This grouping of bits is so essential, that there are names for all kinds of grouped bits. For example, the combination of 8 bits is called 'byte', the first 4 bits of such a byte are called 'low nibble', the other 4 are called 'high nibble'. To differentiate between those 8 bits of a byte, every bit is given a "weight", a unique valence based on the position of a bit within a byte. The power of two valency fits prefectly, because every bit represents two states.

    8 7 6 5 4 3 2 1 position of the bit
    7 6 5 4 3 2 1 0 the power of two represented by the bit if set[/code:1e7v91ps]
    
    To represent 0, we just don't set any bit:
    00000000
    To represent 1, we set the first bit, because 2^0 = 1:
    0000000X
    To represent 2, well, you guess:
    000000X0
    3 is represented by setting bit 1 and bit 2, that's 2^0 + 2^1 = 3:
    000000XX
    
    Now that we grouped bits to represent numbers, how do we tell the processor, what number we want to access? By giving every byte an address, the place (or position), where in our RAM the byte is stored. But it would be very annoying to keep all those addresses in mind. We replace those addresses with something that we can use more naturally.
    
    [b]II. Constants and variables[/b]
    
    When we type '1 + 2', then we are typing two numbers, right? No, we type two addresses. Fortunately they lead the processor to the place in memory, where the numbers 1 and 2 are stored. Isn't that clever? So, the address '1' always leads to the same place in memory, where the number 1 is stored, this will never change. [i]An address that is used this way is called a 'constant'.[/i]
    
    myNumber = 1
    myNumber = 2
    What is happening here? We reserved a place in memory for our own use and gave the address a name we can remember: 'myNumber'. Then we ordered to copy the content of the constant '1' to our address. But in the next line we copy the content of the constant '2' to our address. The content of 'myNumber' changes. [i]An address that is used that way is called a 'variable'.[/i]
    
    Constants and variables are the base of programming. The number of hearts collected in a game changes as we play, so we use a variable. The speed of a car changes as we play: variable. But what, if we need to keep track of the speeds of 100 cars? We could create 100 variables and give them names like 'car1', 'car2', etc. But that is a very tedious task. Luckily, there's a shortcut.
    
    [b]III. Arrays[/b]
    
    We need 100 variables, but they all refer to the same aspect in our game, in this case the speed of the cars. Wouldn't it be much easier to enumerate the cars while accessing all of the variables with the same name? We would know, that speed(1) refers to the speed of the first car, while speed(2) refers to the second car, etc. That's the purpose of an array. It is grouping a greater number of variables and knows their addresses, and the array itself also has an address. When we access the address of the array, 'speed', together with an index, '(1)', the array looks for the variable at the address that is stored at the index.
    
    [i]You should use an array, whenever you need to manage a lot of variables for the same purpose.[/i] You make an oldschool adventure with a parser understanding hundreds of words? Use an array to store those words! You have a map editor to place different objects on fixed positions? Use an array!
    
    As good as arrays are, there is a disadvantage. Imagine another task filling our array with data. Worst of all, it fills the array differently everytime. For example, the cars only add their speeds to the array, if a certain value is reached. Now car 5 may be the first one to store its speed, car 9 the second one, etc. If we then access speed(1), we simply don't know to what car this speed variable belongs to. Don't worry, a solution to our problem is already existent.
    
    [b]IV. Hash tables[/b]
    
    To know exactly what variable refers to the car's speed we are interested in, we need something unique to identify it. We could use simple variables again, but that would make our project very complex. Also we have still a group of variables representing the same aspect, the speeds of the cars. Something like "speed('car1')" instead of "speed(1)" would help a lot here.
    
    But what is speed('car1')? Nothing more than an address to an address to a variable. With this indirect addressing it isn't important anymore, at what exact positions the speeds are stored. The address of the speed of the first car may be stored at index 1 or at index 5, we access it by a name and the functionality behind it finds the right index to our name. That's what a hash table does. [i]Think of a hash table as an array with a clever index aliasing on top.[/i]
    
    The name we use is called a 'key'. This key will always lead us to the correct variable, no matter where exactly it is stored in the array.
    
    You should use a hash table whenever you have to manage a lot of variables representing the same aspect of something with changing count or content and still need to access them quickly.
  • I know, I shouldn't reveal that I shortly got a copy and had a first look at your guide. I personally loved

    Chapter 30: I think, therefore I am. (including a versatile 2-events-AI suitable for every game type)

    And hell yeah, the people will go crazy after reading chapter 5, but I won't be a spoiler and keep it secret.

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