nimos100's Forum Posts

  • Im a bit confused, so in my event which is triggered by a right click, that create an object and depending on the object that is created, it have to do certain things with it. So for it to work I would have to add an "on create event" and based on a variable or something that could track what is suppose to happen with it, do it in the "on create" event?

    And those sub events in my old event,that depend on the state of the object, I would have to move to separate events/functions?

  • Sounds a lot like the problem I have as well. Wrote a post earlier - Post

    I have problems picking them as well. :(

    However my problem is in a mouse right click event, but tried the function thing as you are doing as well and that didn't work either.

  • First of all, I think its a really hard task you have in front of you, and thank god its not me <img src="smileys/smiley36.gif" border="0" align="middle" />

    I haven't actually made any platform games, so not that much into that part and what problems are typical for them. But maybe I can give you some ideas to try, as all the games im working on, uses random generated maps. However this seems a lot more complicated, as I don't think I have the same limits as in a platform game.

    Anyway ill just use a game as Mario as reference, since that's what you mentioned, so if your game is not like that, you can just ignore those parts.

    To generate the map:

    You need to take into account that the character can only jump so high, so you need to make sure that all objects that are part of the map are reachable. As it wouldn't make sense to place an object in the top, if there are no way for the player to reach it, or to place an object just out of jump range.

    So what you could do, is to divide the whole map into a "hidden" grid of lets say 128x128 px tiles, lets say its a 10x10 map. Each grid tile could hold some sort of map object.

    Now you need to fill the grid with map object, and think it would make sense to start from the bottom up.

    Since the player shouldn't be able to fall off screen, you know that all the tiles in the bottom needs to solid. So you can add solid map objects to all of them.

    Then you could go through row 2, and just make a random roll to see if there should be an map object in a given tile or not.

    If you want to go higher, I think I you would have to make a tester of some sort, that would pick a tile and the surrounding 8 tiles. To see whether one is present or not in a given tile. To explain it a bit easier:

    Lets assume that:

    O = empty grid tile.

    X = Map object.

    T = Location of the tester

    Tester looks like this, with the number to represent the tiles needed to be tested:

    7 8 9

    4 T 6

    1 2 3

    So if you want to test the tile marked with the T, to see whether you should/could add a map object here. It would look like this:

    OOO

    OTO

    OXO

    XXX

    The tester will check the 8 tiles surrounding it, to see whether it can add an map object or not to its current position. Since the player can only jump 1 grid tile (128px). So testing the grid tile at position 1, should return "bad position" or something, as it doesn't have a map object, so placing a map object at T current position would make it look like this:

    OOO

    OXO

    OXO

    XXX

    And impossible for the player to jump there.

    Then you would go through each row of the grid and test each tile like that.

    Spawning random monsters

    Assuming that you made a tester as above you could use it to spawn random monsters as well. Either by marking tiles as "containing" a monster, and based on whatever conditions you want, make it so it can not spawn 2 monster on two tiles that are next to each other.

    Anyway, think you could make it like that. But it would probably need a lot of extra work, as the maps might tend to be rather boring, the you could ofc add tiles that trigger something when the player is on them, but that will make it even more complicated....but think it will be very hard to make regardless. As I can only guess the amount of bugs it could create :D

    But anyway maybe you can use it for something, if not its fine as well :D

  • Sorry I don't know, I haven't actually looked at that effect at all. I just know a little about it from doing 3D. And even there I haven't used it a lot. And whether you need an actual normal map in C2 or whether you can just fake it with a grey scale bump map and still get that effect I have no clue. But will try it at some point because it looks cool :)

    However think this is a very good page that you can go through to learn more about normal maps, lighting etc. And see if you can apply it to C2. I haven't looked through it all, but first impression is that its really good, and will probably give you a good starting point, to understand and creating your own normal maps, so they work in C2.

    Normal mapping and lighting

  • Im not sure how he did it, but might have been done, but adding a normal map to the floor. So my guess is he used/might have used a program to generate the normal map and then use the bumpmapping effect in C2. I cant see if the normal map is "accurate" or not. So that's why I said he might have used a program to calculate a correct normal map, or maybe just a "fake" one.

    However it works like that.

    "To calculate the Lambertian (diffuse) lighting of a surface, the unit vector from the shading point to the light source is dotted with the unit vector normal to that surface, and the result is the intensity of the light on that surface. Imagine a polygonal model of a sphere - you can only approximate the shape of the surface. By using a 3-channel bitmap textured across the model, more detailed normal vector information can be encoded. Each channel in the bitmap corresponds to a spatial dimension (X, Y and Z). These spatial dimensions are relative to a constant coordinate system for object-space normal maps, or to a smoothly varying coordinate system (based on the derivatives of position with respect to texture coordinates) in the case of tangent-space normal maps. This adds much more detail to the surface of a model, especially in conjunction with advanced lighting techniques."

  • Another way if its not a lot of numbers just store it in a local variable.

    Then add:

    Roll = 3

    Roll = 5

    While()

    And in the Action add Roll = round(random(59))

    Then if its roll 3 or 5, it will roll again. and continue if it doesn't.

  • Hi

    I have a function that can generate objects when passed a parameter for instance "Stone" and it will then create a stone at the player position, and set a global variable "Last_generated_item" to its UID.

    However If I in the next sub event do "pick item with UID = last_generated_item" it doesn't select it. I am aware of the newly picking thing problem. However if I use "wait 0" it still doesn't work.

    I have also tried adding a "system object with UID exist" in the next sub event and print out the UID of the "last_generated_item" to a text object and it works fine. So I guess the object must be there to be selected as I can get the UID of it.

    However if I move the text object to the event with the "pick item with UID last_generate_item" it doesn't react to it.

    Now the weird part is I do the exact same thing else where in my game, and it have no problem selecting the "last_generated_item" even without a "wait 0". So why it doesn't work here is really weird.

    I have also tried to return the UID of the object created in the function and use the "returnvalue" instead and it give same results as using the global variable.

    The only difference that I can see, is that the first ones were made in another version of C2 and this is made in latest beta version. However cant see why that should make a different.

    But anyone have any idea why it doesn't work? And if im doing it wrong, how would you correctly select an object that was made in a function?

  • Unless im missing something, i dont think its the same feature, as that one saves/load the full state of your program.

    This one would save the state of an layout, so when you load it, it wouldn't change anything else. So you for instant could go back to an old layout. However the current feature could almost do it, if only you could turn on/off the "no save" behavior on demand.

  • Are there any ETA on this feature?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There is a build in loader style, that you can set to Procent under the project tab.

    Otherwise you might be able to make a sprite animation looking like a loading bar. And use the loadingprogress functionality under system to control it.

    However i havent tried it myself yet, so exactly how to set it up and make it work i dont know.

  • Anyone knows where save games are stored on your computer, when you use the save game feature?

    Also how do you delete save games from within a game?

  • Think it would be nice with an edge tracker, or outline effect. so if you add it to a sprite it will based on your settings add an outline around the graphic in a sprite. Which would be very useful for when a player select items in game etc. Or for mouse over effects to give players feedback of interactive stuff in a game.

    Maybe the settings could just include a pixel size of how large the outline is. And maybe a color setting.

  • Try in the second one with the tiled background to add an inverted "on touched sprite"

    So it only resets when it hits the background and not a sprite, and see if that works.

    You can just copy/paste the condition from the first one and invert that.

    Not sure that will work, since they are both "green arrows" so you might need to use an "is not over sprite" condition if there is one for touch.

  • Yeah I know that 7500 images are quite a lot, but its just a test, since the other browsers doesn't seem to have a problem with it.

    But did you try to refresh the page with F5 and see if the problem went away as well?

    Because it seems that it can actually load that many images, but maybe not during the initial startup for some reason. But I don't know how images are handled when you preview a project in C2 and how chrome deals with them. Meaning that if the images are stored in some cache some where, and it cant load them fast enough and simply start the program while doing that in the background, and then the animation catches up with it, before its done or something, and then throws an error.

    But if I delete so there is 5500 images, it doesn't have a problem during the startup either.

    But its a bit weird, because in my actual program, where it also does it, there are only 9 images and 1 list in the first layout and it goes wrong as well, But in the "Remember not to waste your memory" - it says that:

    "In Construct 2, images are loaded layout-by-layout. This means when a layout starts, every object on the layout is loaded in to memory immediately. This is to avoid mid-game pauses as textures are loaded on the fly. When the layout ends, it will free all the images in memory not used by the next layout, and load any new images the next layout uses. This means your game's peak memory use is based only on the layout with the most images, rather than all the images in the project."

    So that would mean if I understood it correct, that those 10 objects are the only ones being loaded into the memory at the start. Which I don't really understand because in the javascript console I can see that images that are not part of that layout, are also being listed under the "Failed to load resource", so I guess its doing or want to do something with these images, even though they are not part of the layout. But I did a memory usage test on the main page and it uses 11 not full screen and 18 in full screen, so its not a lot I guess, and seems to be as stated in the "remember not to waste your memory". So what exactly its doing with the images from the other layouts are a bit weird.

  • I should probably have been more careful adding the images. However I "optimized" it, so now it uses only 91.9 mb, and removed 1000 images of the 512x512 cube, so its now 7500 frames.

    However it still does exactly the same as before. And didn't seem to have any impact what so ever.

    Here is the new Capx, which is about 13 mb.

    New capx

    Can you check to see if you still get the same problem as I do?

    I tried adding a timer and a memory usage text, to see what it said. And the memory usage is about 33-39 while running, and after 13s or so, one of the cubes disappear. Like it starts the application before being sure that all images have even been loaded something, which could explain that 13s of animation with a 30 FPS is 390 frames, and the javascript console starts reporting "cant find resources" for the disappeared cube around frame 390+. This varies a little bit it seems. But don't know if Chrome caches the images or loads them into memory or C2 does it, and the application is started before this is completed.

    So when it reaches those frames, it screws up or something, as it cant find them. However if you refresh the page by hitting F5 the problem seem to go away, and the cubes no longer disappear. Which could suggest that since most of the images are already loaded, it can easily load the rest and therefore the problem goes away. However Im completely guessing :D