saumanahaii's Forum Posts

  • It doesn't work if you just put all that left mouse button down code into the left button clicked?

    If not for some reason, you could use a variable and use the general condition compare two general values. Use the variable as the first and check if its 0. If it is and the mouse button is pressed, create the object. In the body of the left mouse button is down, set the variable to 1 so its not 0. Then, when you let up the mouse button, set it to 0. That way it only works again when you let off the mouse.

  • I knocked together a (really, really hacky. Seriously, you should probably clean this up!) example of this. Basically, I generate a value for each door, choose 2 and add them together to get the solution, and then listen for input over the door. If you press X over a door, it adds it to a value on the character, which I've displayed over its head. Then, if the character's value matches the value of the door and you press X, then a win message is displayed. It should be enough to get you going in the right direction. You might want to add a variable for operators, for example.

  • I've knocked together a level editor in Construct, and I'm able to save out the locations and names of each object to an array stored in a local JSON file. These are going to be the actual levels for my game, though. So how would I go about getting them to go automatically into a file in the project folder structure?

  • Put in a timer to delay the firing of the event. Say, half a second between triggers.

  • Ok, I've been working on a workaround anyways. Thanks.

  • That only works on the instances though. At the time of me going through it, there aren't any instances. I'm trying to go through the group itself.

  • And done. Might have been better to create instances of a single boundary rather than have a new object for each, though. Then you could have used a single event to reference the ID and been done.

  • I actually have a file for that! Its designed to work with a physical controller, but the code translates quite readily. Its a bit messy, but I highlighted the important parts in the image.

    Ignore the ugly background. It turns out the texture brought the file up over the 2 meg limit.

    Basically, the function you need is Angle. It takes 2 points, so if you're making a touch joystick take the origin of the joystick as point 1, and the location of the touch as point 2. angle(JoyOriginx,JoyOriginY,TouchX,TouchY) .

  • If you're triggering it from a button, then when the button is clicked set the global variable to TextBox.Text . You'll also probably want to set the textbox type to number. If you're going without the button, then have a different variable that stores the number. Then, have an event for when TextBox.Text != PreviousNumber and use it to set PreviousNumber = TextBox.Text .

  • I knocked together a quick example. Hopefully the code is understandable, but keep in mind its probably pretty rubbish. The technique works though.

    Every 2 seconds I generate a random number, which I take the ceil of to round up. I compare that to the LastPlace variable I made, which starts at 0. When they don't match, I go ahead and print the place to a column on the left, then set the last place to that random number. Then I generate another random number and check if they match. If they do, I generate another random number using the same formula, and print a message in the column on the right to show that its working and when a collision has happened.

    I also used a boolean in the sample to show you how to work with it. To check whether its false you have to invert it from the right click menu.

    Now you just need to translate the places into destinations.

    [attachment=0:2r0cul4q][/attachment:2r0cul4q]

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've added one to the code. Basically, the logic goes like this: there's a Critical Window, which I saved on the enemy. I made it 75. Then, when the bullet is generated, I create a random value between 0 and 100 and save it to an instance variable. I compare that to the enemy's CritWindow, and if it's greater than the window, I set a variable on the bullet IsItCrit from 0 to 1.

    Then, for the damage calculation, I do the following:

    Bullet.bulletDamage+Bullet.bulletDamage*(Bullet.IsItCrit*Enemy.CritMultiplier)-Player.Defense[/code:59ong6bk]
    
    What that does is take the base bullet damage and add to it the bullet damage * the IsItCrit (which will determine whether you're adding nothing or a crit value to the check) and then mulitplying IsItCrit * the CritMultiplier I also added to the enemy.  I'm sure someone else could clean it up, but that's how I did it in the CapX file I linked you.  I'm pretty sure it works right.
    
    Oh, and the evade could be calculated the same way, multiplying the damage by either a 0 or 1 depending on a randomly generated number.  Hopefully this is what you need!
  • I'm working on a level editor for my game, and I have a family called collidables you can run into. I've gotten a bunch of the editor working, but now I need to be able to select the family elements so I can actually create the level. I figured I could do this by going through each element of the family and pinning it to a scrollable background element, but I can't figure out how to iterate through the family. Help? Thanks in advance!

  • Turns out I was a little hasty. Basically I was rolling my own movement code when I could have just used the Physics behavior. That simplified things and fixed my bug.

    Basically what you're looking at in the photo is the highlighted line. It takes the X and Y of the Waypoint and calculates how much to move the character by based on how far the waypoint is away. So if the waypoint is 5 units away from the character's X and 5 units away from the character's Y, the character moves so that the x difference will be 0 when the y difference is 0. See this video: "www.youtube.com/watch?v=0TecJZYX75c&list=UUkC_TF5BPrxTAXt0M5Pxy0A" Thanks though!

  • [attachment=0:bhl8dxt8][/attachment:bhl8dxt8]

    So, I've got a line of code highlighted that's causing a problem for me. It works, about 98% of the time. But its a pretty core piece of functionality. What I'm doing is moving my character from point to point on the screen, with spikes that cause death on either side. The code is supposed to adjust its location to the waypoint's Y over the time it takes for the waypoint to cross the Y. About 1 out of 50 times though it overshoots. I'm assuming there's a better way to do this than what I managed to mash out, so help?

    The character only moves on the Y axis, and the waypoints have a fixed Y but move on the X axis.

  • And now I feel like an idiot. Didn't even think to check for those. Thanks, they're there! And they work.