nimos100's Forum Posts

  • Hmm nothing from the screenshots seems to cause any problems from what I can see. Do you get the same performance in other browsers? And are you using any effects?

    Also have you tried to disable the menu events one at the time where possible to see if you can pin point where it happens?

  • So I'm struggling with this. I want an object to move between 3 different points on the X axis, like this: * * *

    The object starts in the middle, then if I press the left arrow key it will snap to the left point. If i press the right arrow key it will snap to the middle and if i press right again it will snap to the right and vice versa. It's a simple mechanic but I'm struggling to make this work properly. I tried using the MoveTo plugin by REX and it works between 2 points but I can't for the life of me, figure out how to make it work seamlessly between 3 points. I have no idea what the best pracises are for these kinds of mechanics.. Any help is greatly appreciated!

    There are lots of ways to do this, but the easiest might be to simply make a variable in your object called "Position" or something. This variable then hold the current position of the object. Like so:

    (X = 1) (X = 2) (X = 3)

    Then in your object you simply check what value the position is, when you press a key and add or subtract based on the key pressed.

    So if the object starts in the middle the "Position" variable is 2. Pressing Left key you subtract 1 from Position and if its the Right key you add 1.

    Then you can make 1 small sprite object (Named location) and give it an index variable and make 3 instances of it, each with a different index that relate to the position, so it would be 1 for the left one, 2 for the middle and 3 for the right one, then you can use those to easily control the position of the object, and so you can move it around later if you need to without having to change any code.

    And then you add something like this:

    Function Update_Object_position
    Pick Location.Index = Object.Position
    Set Object.X/Y to Location.X/Y
    [/code:1h4ielcw]
    
    Then you ofc just have to add the keys to add and subtract from object.position and make sure that position cant go below 1 or above 3, and call the function each time one of the keys are pressed.
  • Try to post some screenshot of the menu code and the debugger especially the system tab and the profile window. Don't think anyone can help you unless they have at least something to relate to.

  • Thank you for help!

    It's actually too complicated for picking tile by ID for a non programmer like me.

    I guess one day there will be simple condition like :

    add new condition > on collision with another object > tileMap (indicate tile ID in text field below)... and that's it!

    Until this kind of improvement, I will use tile map only for decoration.

    The tilemap is not really that hard to use once you understand the basics of how it is constructed.

    Image (1): Just using the basic tilemap in C2. You can look at a tilemap as being just a collection of images combined into 1 image. The reason to use a tilemap is because you can reuse a lot of graphic and reduce the performance hit from using a lot of sprites. So instead of adding lots of objects you simply add a tilemap and reuse the graphic over and over. There are some other benefits as well, but to keep it simple ill just focus on the basics.

    Image (2): Shows a single tile in the tilemap, which current size is set to 32 x 32 px, this is equal to adding a sprite and setting its width and height to 32px. But since the tilemap split the image into tiles, you need to tell C2 what size these tiles are, so it knows how many tiles the tilemap should contain.

    Image (3): Once the size of each tile have been set, C2 split the image into tiles and give each of them an ID, so its easy for you to see which graphic belongs to what tile. And it makes it possible for C2 to work with the tiles. This ID identify what image is related to a given tile. And can be compared to you making 2 sprites and calling one of them "Image_1" and the other "Image_2".

    Image (4): Guess this might be what confuse you a bit. But the tilemap object can be compared to adding a lot of sprites next to each other. But instead of you having to add all of them, you just add the tilemap object and C2 will then split it up for you in the tile sizes that you set in Image (2). The tilemap object, that being the one in the C2 viewport will be split into areas that match the size of the tile width and height.

    So a tilemap that is 320x320 px and have a tile width and height of 32 x 32 px will have 10 tiles in X and 10 tiles in Y. And each of these tiles will have an index so C2 know which tile is which. Looking at Image (4) you can see the tile coordinates, which always starts at 0,0 in the top left tile. This coordinate have nothing to do with the X,Y value in the normal coordinate system that C2 uses. So you can place the tilemap at X: 500 and Y: 500 in the viewport, but the top left tile in the tilemap will always be (0,0).

    Image (5): Shows a tile placed on the tilemap, this tile have the tile position of (2,1) and looking at the overview in image (3) you can see that the ID of the tile is 0.

    If this is makes sense to you, you can see that you can't work with a tile ID alone. Because it simply relates to what type of tile it is. You have to first tell C2 which tile coordinate you want to test.

    And you do that by using the condition "Compare tile at":

    To test it:

    So you just have to remember that Tile ID and Tile coordinate cant work without each other. The Tile ID is the tile graphic in the tilemap, and the tile coordinate is on the tilemap it self.

  • You do not have permission to view this post

  • The Tile ID is the tiles position in the tilemap. So you have to check for it like in my example.

    1. Which tile you want to check

    2. What type of tile is it

    In my example above I check the tile underneath the bullet and check if that is a tile type of 4, which are the ID you are talking about.

  • This is an example from another thread, what you are looing for is condition (4), that's how you can check if something is overlapping a specific tile on a tilemap.

    (Be advise that the tilemap at row 0 for both X and Y is empty so its not an error that it seems like it should be tile 3,7, its just me that didn't put any tiles in that row, so the white area around the tiles are actually row 0)

    If you want the coordinate in X,Y you can just convert the TileX and TileY to that.

  • Also, Firefox analog control is a bit wonky, anyone else have issues with it?

    Didn't knew that timers could cause problems depending on what browser you use. But in general there are some issues with how games are presented depending on the browser used, which is really avoiding, as you are never sure if your layout will be the same in the editor and in runtime. So might be something similar with the timer. However don't know how to fix it, as I do all my testing in NW.js

  • good game dude

    Thanks, unfortunately the game is dropped for now and only the idea remains, but hope to pick it up again sometime

    You respond half an hour later. Did you delete your post in the meantime? Cause I can't find it now. Great misuse of power, now I don't have anything against you.

    Not that I want or care to get involved in this discussion you have going. But just saying page 6

    And regarding the pathfinding, I can completely back you up that it's kinda wonky and hard to use. For my game I wrote my own pathfinding method through events and it worked out fine for me. I honestly don't know, I'm used to dealing with roadblocks like this, maybe I'm just jaded. Maybe C2 really is a very bad suite and I'm just the sucker who tries to make things work in other ways. Maybe I'm also a bit biased since I've done a bit of coding in the past.

    Well think everyone solve a lot of problems, not related to C2, but just because, when you make games you run into problems, and if you aint willing to work to solve it, well then it will end quickly. But the problem I was referring to with path finding, is not something that you can "event" yourself out of. But is a flaw or unfortunately design in how it works in C2, and that's not something you as new user would spot. But completely agree with you a lot of the fun in using C2 is to make things work. But it shouldn't be the wrong stuff. Like making workaround for importing audio file, the object already have a source in the editor, you just cant access it in the code...these things I really don't like doing, because it doesn't seem like you are solving something as much as you are patching up some "unfinished" stuff.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I worked on it using your sample but it seems that C2 does not understand this part

    As a result, it does not recognize tiles around the cactus.

    I downloaded the Capx and it seems like you get confused about the tile coordinates. In the screenshot you are setting a lot of tile positions, which makes little sense. First of all, to do comparisons with a tilemap you don't need/benefit from storing any tile positions. As it contains so many tiles, in theory you don't have to store any tile positions at all, the only reason to do it is because its faster to just store the tile positions than having to convert them all the time. But it makes no different when working with them. When I store tile position for objects, its only for non-tilemap objects, like the bullet sprite and so forth.

    Whenever you have to compare something with a tilemap you have to convert the X,Y position that you want to compare or you use the tile position that you generated before hand. Again it makes no difference in how C2 works, its purely for your own sake that you do it!!.

    This is the only part that need a conversion, because that is what keep track of the bullet position. And instead of having to keep converting it, whenever i want to compare the bullets position with something on the tilemap. I just do it here and store it in the bullet.

    This is where it goes wrong. Because the initial condition and the one we are interested in is the bullet position compared to the tilemap. In the first line i use a "Tilemap.TileAt(Bullet.TileX, Bullet.TileY) = 15" This is the part where i might as well have converted it on the fly, like this:

    But as you can see it requires me to write a lot more code, so to save time I just convert it once and use Bullet.TileX and Y instead. But the code does exactly the same.

    Moving to 9-11

    You are comparing Tilemap.TileX = Bullet.TileX Which is fine.

    But you are also comparing Tilemap.TileYmin1 = Bullet.TileY - 1, which doesn't work because that is set in the start of layout, when the bullet position can be anything. So this comparison will never be true, and its the same for all the checks that is done. The reason it write that no tile was found anywhere around the cactus, is because the Else is misplaced, and will always be true because (10) will never be.

    The way i would do it, if i understand you correct, is to layout what I want to happen. Meaning write down the flow you need to make it work.

    1. Bullet hit cactus
    2. Check if there are other cactuses around the bullet.
             a. There is another cactus around the bullet -> Do something.
             b. There is not another cactus around the bullet -> Go to 3
    3. Check if there are any green tiles around the bullet.
             a. There is another green tile around the bullet -> Do something.
             b. There is no green tile around the bullet[/code:10ged27y]
    
    Then go through each step and add them to the code. Even though you might already know what you want to happen, outlining it can be very helpful I think, especially if you need to keep track of a lot of positions and so on. Because it seems you get confused with what you are trying to do, and what you need to do, to make it work. So you start adding a lot of variables that are not needed.

    > ...when people express there view about C2 they get flamed or as you write "just learn to code", but C2 state on the front page that no programming is required.

    >

    This is also what I've said earlier. You're repeating my posts but putting it in another angle lol.

    Guess people now are too offended of what I already said to continue the discussion in a constructive way, instead they blindly defend C2 with all they got and bullying the OP with their "high fives" to each other.

    Well since I don't hold any specific views on C2 other than I like it, I guess we agree on something then

    "just learn to code"

    That's not what I said. I said that you have to learn the program, its ins and outs, understand its scope and if there's a feature you want but the program doesn't support, you either make it yourself, or move onto another thing that suits you better, but only as a last option hence "if all else fails". I understand that the point of paying for something is for someone else to do it for you but it is also the buyer's responsibility to understand what (s)he pays for. Construct 2 does exactly what it says on the can and if you want to go beyond the scope of the suite you have to make yourself uncomfy and write your own stuff, but only if you want to go outside the scope.

    I completely agree with that you of course have to do your research, before just throwing yourself into something, at least to some degree. I have used C2 for a long time now, a little over 2.5 years I think. And still some of the issues I stumble on are objects that I have used a lot of times, but just certain feature that I haven't had use for so haven't been an issue before. So expecting a new person to make a comprehensive judgement on whether C2 can do what they want or not, is not easy I think.

    And notice lots of people asking whether some sort of project is possible in C2 or not, before they throw them self into it. And its even hard for the more experience users to give them any clear answers whether its possible or not. At least I find it very difficult, because you have to try to judge whether something that they are trying to do, will work based on your own experiences with C2 where you ran into something that was simply not possible and made you drop your a project.

    For instant the path finding, which is one of my favourite topics. A new user will have a very hard time judging whether it can do what they want it to. And on the surface it seems to work fine, but with experience you notice the problems. That just can't be solved regardless of you can code or not. And see no reason to defend C2 in regards to something like this, as a game engine and knowing that path finding plays a huge part of a lot of games, it should have been designed correctly the first time. But expecting a new user to figure something out like that, I think is beyond what you can expect.

    And if all else fail, learn to code and make it yourself.

    Maybe I'm just easily impressed, I don't know. I think C2 works just fine for what you pay for it.

    C2 can do a lot, I agree and think its reasonable priced. My point is just that regardless of whatever product you buy, that being a car, a beef whatever, you pay money to avoid having to do something yourself, its no different with C2, its a product like everything else, if you make a game then that's your product and people will complain to you whenever they think you did something bad. They paid for it, because they didn't wanted to make it them self.

    But following the forum, there is a tendency i think, that when people express there view about C2 they get flamed or as you write "just learn to code", but C2 state on the front page that no programming is required. So guess that a lot of people choose C2 so they don't have to code. So at least to me, it seems perfect valid to state ones view about C2, whether you care to learn to code or not.