InDWrekt's Forum Posts

  • Set the second condition in each sub event to an else condition. The way you have it set right now, the sub events trigger consecutively meaning, as soon as you set the value"nuke" and "spawn", the second condition is always true.

    Just to be clear, the 2 conditions "Commander.controlmode = 'nuke'" and "Commander.controlmode = 'spawn'" should be changed so it is just an Else event. This means when the condition before it is not true this condition is true.

  • OK, so I took some time to modify your project and add what I had suggested. To be honest, I don't completely follow all of your logic, so I didn't do any optimizations like I usually would. I did however, have to move around a few events to get it working. Take a look at the changes and test it out. You may be able to run with it and make it much more streamlined with your methods.

    As for your question... Yes, you can combine and/or logic in 1 event. Take a look at event 5. I embedded a simple if/else statement to a set of conditions and wrapped them with an or block. If you don't understand the statement, do a search for "ternary operator" without the quotes. This is a common programming operation and can be used in Construct to simplify a set of if/else events into a single event. Simply put, the first condition says:

    if Pos1X equals Pos2X and Pos1Y does not equal Pos2Y then return "True" if not return "False"

    The value returned is then tested against the "True" string in the first value. There are many other ways this could have been accomplished but, I have been on a ternary operator kick in my examples lately, so that is what you get.

    I hope that clears things up for you and good luck with your project.

  • I'm getting the same issue when using Chrome. In Firefox, it worked for me though, did you try using another browser?

    BTW, I got a kick out of all the different "death" animations. It's pretty funny. Are you supposed to be able to jump mid air over and over again? I played an entire game where I just tried to see if there was a limit to the number of times I could jump in the air without touching the ground and made it like 10 times before running into a speaker.

  • I downloaded your project and took a look. After the player selects the second tile, you are not doing any validation at all to see if the second is valid to select. If you want to disallow diagonal movement, you need to test the second selection to see if it valid by adding a condition on the event that moves the tiles. This could be as easy as adding a test like this:

    if (selected1.x = selected2.x and selected1.y != selected2.y)

    or

    (selected1.y = selected2.y and selected1.x != selected2.x)

    The entire above block of pseudo code needs to be set as a condition to move the block. Basically it says only move the pieces if either the x values or the y values or different but not both (XOR). You would of course have to figure out how to model it in Construct. This block of code will also work even if the size of the puzzle was larger than 2 by 2.

    Of course this is only 1 way to handle this kind of situation. As it is, you have colored blocks you are placing along the vertical and horizontal lines. You could make sure at least 1 of your tiles is on a block which also contains the color of the other block. This would also have to be set as a condition on the move event. You don't need to check both selected tiles because if 1 is on a color the other will always be as well. This is a rather ugly way to do it, but may work better for you. Especially if you intend to extend the board out and only allow movement to the square directly adjacent to the selected tile.

    I hope one of these solutions works for you and good luck with your project.

  • I would have to see the capx to get an idea of what is going on.

    [EDIT] NVM, I see what you mean on the version I already have. Looking into it now.

    [EDIT] OK, that was an easy fix. I added a variable called, "MonsterExists" 0 for false and 1 for true. I destroyed the off screen monster on start of the layout (you could also just move this monster into view instead of destroying and recreating but this took the fewest steps to get your current set up working) and I added a few actions to your create event including setting MonsterExists to 1 and moved the monster disable action into this event instead of the start of layout.

  • Ok, I have cleaned up your events and have it doing what (I think) you want it to do. I also duplicated your monster follow events to make some equivalent human follow events. This may not be what you want, it is just to show you the setup works both ways. You can find the capx attached.

    A couple notes:

    I noticed you had a couple every tick events as sub events. An every tick event which has any other conditions is redundant. Read this page to get more information:

    https://www.scirra.com/blog/141/common- ... nd-gotchas

    I also noticed, your events to change which player is selected were set up in a way that they were firing every tick. With small project, you wouldn't notice, but as your project grew in complexity, it could really bog it down. I added an event at the start of layout to disable input on the monster and moved all of the events to switch which is controlled as sub-events to the space bar event. That ensures they only fire when you want to change users, not every tick.

    I noticed a scroll to event at the end which, because of your camera seemed redundant. I am not sure why it was there. If there is a reason I don't know about, you will want to add it back in.

    I gave the camera the ability to follow the monster when it is the selected character.

    Finally, because you were using the lerp function to move the camera, I figured the easiest method to move the follower would be to use the same method. I figure if you know enough about it to use it, what I did should make sense to you.

    As a bonus, I decided to help you cut down the number of events by 1 more. Where you set the selected value, you were adding 1 to the value. Then, in a separate event, you were checking to see if the value was above 2. If it was you were setting it to 1. This method works perfectly and is a good way to make this kind of change but eats up another event unnecessarily. So, I threw in a function you can use in your future projects. The method is "whichcharacter = 2 ? 1 : 2". This is a very simple if/then statement and can be used any time you have 2 possible results. This is what it means:

    whichcharacter = 2 -> If whichcharacter is equal to 2

    ? 1 -> Then return 1

    : 2 -> If not, return 2

    Because I wrote the function in the action to set whichcharacter, the result is, whichcharacter is set to the return value. So, if whichcharacter is currently 2, whichcharacter is set to 1. If not, it is set to 2.

    Well, that was a long one but I hope it helps. Good luck with your project.

  • I am looking at it now. When I get done going over it, I will try to post an updated version with it working for you. That being said, I noticed 1 thing that will probably help you get a little further. You are disabling the platform input on the deselected character, but you are trying to use the simulate platform button pressed to move it. If the input is disabled, you cannot use the input to move it. That is why the monster is not following when the human is active.

  • Is there a reason you need the event to be a click or touch event. Those events are used specifically to take player input. I guess what I am saying is, trying to use a click/touch event without user input is the complete opposite of what those 2 events are for.

    If you just need an event to fire repeatedly, you should use either the "Every Tick" event, or use a timer with delta time. If I were you, I would look up how to use delta time and make an event that just fires every few milliseconds (or how ever long it is you want between each time the event fires).

  • I understand that, and I can see from your image it is a Sprite object. When you added it, did a window like the one in the image below pop up?

    [attachment=1:15l0fe4a][/attachment:15l0fe4a]

    This is the place you create the Sprite. Whether you load an image or draw one, this is where you would do it. If you just closed this window, the sprite is a blank image and you get the result you are seeing. If this window didn't pop up when you added the sprite, double click the sprite object in the right menu under either projects, or objects (circled in the image below). That should open the above window and allow you to create your sprite.

    [attachment=0:15l0fe4a][/attachment:15l0fe4a]

  • I would love to help out but, I think we are going to need a little information. Do you mean ALL objects, no matter what you put on the layout are not visible? Is it happening on every project you create? What steps are you taking to create the project and create the "invisible" object? Could you post the offending project and let me take a look at it?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • queuethulu

    You might want to check if your mouse has it's own software running which changes the default middle click function. For example, Logitech has a software package called Setpoint which allows a user to change the default function for all mouse buttons. The default for the middle click is "Application Switcher" not "Middle Click" so when a new user installs the Setpoint software, their middle click gets messed up. I am not sure what your mouse is but, you may find a similar issue which is causing your middle click not to work here.

  • There are a few things missing.

    You are not registering the location the touch ended. In the events 32 and 33 System->compare 2 values, the touch.x is the initial touch location because it is in an on touch event, not the touch end location which would be registered in the on touch end event. This is needed to define which direction the player dragged their finger.

    In my example under event 2, I am storing the position from the on touch event so I can compare it with the position from the on touch end event. In event 3, I am using an on touch end event to get the direction. Because you are only allowing left and right movement, you will change that event to simply check if Touch.X (which is now the position the touch ended since we are accessing the value in the on touch end event) is greater or less than Block.X and move the piece accordingly. If Touch.X is greater, move it left. If it is less, move it right.

    [Edit] I just went back and read through your original post again and realized you are not just allowing for left right movement. So, you will need to look back over event 3 and learn how sub events 4 and 7 are defining the direction.

    Of course, if the above appears too difficult, you could always draw an on screen directional pad and wire each direction in the same way you wired in the keyboard.

  • The answer to any question like this is always, "It depends." First, we don't know what you would consider "worth it." Second, if you are only placing your project on the Chrome store then, not matter if you are selling or getting ad income, you are limiting your income. In any case, my humble suggestion would be to place a free ad supported version and a premium paid version to max your income. You will get far more downloads on the f2p version and if people like it enough that they are willing to pay to be rid of the ads, you will get a little added income.

  • rwcatalano

    Glad I could help. As for your response saying option 2 sounds cleanest, I just wanted to float an example of option 1 your way:

    [attachment=0:1npriaet][/attachment:1npriaet]

    The image is all it takes to do option 1. I have included the cap so you can see it work.

    Not saying to change. The second option should work just fine for you and be more appropriate in your project. I'm just pointing out that the first suggestion is actually much more clean and compact.

  • Technically, if there are only the 2 options, touch the object, or touch the background, you could remove the on touch event for the background object and have a single on any touch event. This event would have a sub event for touching the correct object and an else sub event to handle anything else. This would remove any possibility of the on touch happening on the background object.

    If this is not the intended result, you could add a condition to your background on touch event that says not touching the object.

    I hope one of these suggestions works for you and good luck with your project.