AllanR's Recent Forum Activity

  • Triforce

    you can set "Unbounded Scrolling" to yes in the layout properties, then the world can extend forever. You just have to generate the world as people go.

    You may want to read up on Perlin Noise. There is a noise plugin for C2. That allows you to pick a seed number and then generate consistent results for your map at any given coordinate. (This is how MineCraft builds their worlds).

  • wirelesstkd

    Ashley wrote a great blog post about lerp here: https://www.scirra.com/blog/ashley/17/using-lerp-with-delta-time

    The reason why the example you followed slowed down is probably because the first value in the lerp expression was being updated every tick. So, the distance the sprite moves gets smaller and smaller as it approaches the target location. This provides a nice ease in effect (if that is what you want - which you don't).

    eg: Set Sprite.x to Lerp( Sprite.x, TargetX, dt )

    Sprite.x changes every time the expression is evaluated (and is used inside the lerp expression), so the amount the sprite moves each step of the way is reduced as it gets closer to the target - which slows it down. since you want a constant speed, you need to change the third value in the expression (the percent moved from value1 to value2) without changing value1.

    eg: Set Sprite.x to Lerp( StartX, TargetX, percentMoved)

    when percentMoved = 0 the sprite will be at StartX

    when percentMoved = 0.5 the sprite will be half way between startX and targetX

    when percentMoved = 1 the sprite will be at targetX

    so, as percentMoved changes from 0 to 1 (or 0% to 100%) the sprite will move at a steady speed (as long as percentMoved changes at a constant speed).

    You just have to be careful not to change startX or targetX while the sprite is moving.

    If you add dt to percentMoved every tick, then it would take 1 second to move from startX to targetX.

    but since you want the move to take 0.5 seconds, you want to add dt*2.

    I made a quick sample here: http://www.rieperts.com/games/forum/lerp.capx

  • mchulet

    you were very close - and had the right idea. The main trick is to get the image points and initial angle correct.

    In C2, Zero degrees points to the right, so it is a good idea to have images facing that way and then set the origin on the left edge. That way, when you set the angle to point to the mouse it will work the way you expect. The only other thing to remember is that a clock assumes that Zero degrees is pointing straight up - so you have to add 270 degrees to an object to get them to the correct place as far as the clock is concerned. Since there are 60 seconds per minute, the second hand moves 360/60 or 6 degrees every second (and so does the minute hand because there are 60 minutes per hour). The hour hand moves 360/12 or 30 degrees every hour.

    you can download my version of your capx here: http://www.rieperts.com/games/forum/clock.capx

  • radhaw

    the problem is the joystick is only looking for "Is in touch". So, when you touch Sprite4 to fire, that will also affect the joystick, because "Is in touch" is true.

    To do a proper multi touch interface, you have to track each start and end of each touch by their index. It gets pretty tricky but is possible.

    for your example, you can (mostly) get it to do what you want by adding another condition to both event 3 and 4 that says:

    Touch > Not is touching Sprite4

    ( to do a Not, add a condition that says Touch > Is touching Sprite4 and then right-click it and choose invert )

    The only problem I had with this simplified multi touch, is that the joystick stops responding if you hold your finger on the fire button (sprite4).

  • Gamesmeir and OddConfection

    OddConfection is correct, but an easier way is to use Replace

    Global text Example = "Hello/nWorld"

    then at start of layout...

    System > Set Example to Replace(Example,"/n",newline)

    (Replace will replace all occurrences, so there can be multiple /n within the string. Obviously this wont work with Constants because you can't change the value of a constant, but then whenever you use Example you will get the desired result.)

  • X3M

    Wow, that is rather alarming that it is that easy to change variables like that. I had never used the console like that before, so I played that first game you linked to, gave myself all the lives I wanted, all the coins I needed to buy all the upgrades, whatever score I wanted... if my health got too low, I could just pause the game, set my health back to full and then continue on.

    encrypting every important variable in a game seems like a lot of extra work and overhead, but what else can you do? I guess keep track of key presses, mouse clicks, and time in game so you can estimate if the score is possible (and encrypt those values too). Maybe keep multiple copies of some variables (in different forms) and test for hacking, or leave some honey-pot variables unencrypted to see if someone is trying to cheat.

    Like newt said - anything can be hacked, but it should not be possible for a complete novice (like me) to completely defeat a game in a few seconds! I guess if you want to keep Global leader boards, you could keep code for testing whether the score is valid or not on the server. But they would still be able to see how the data is assembled to be sent to the server and eventually reverse engineer it.

  • Try Construct 3

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

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

    I am not a fan of wait actions. Because while you are waiting, you might need to change what should happen next.

    I made a quick sample of how I would "schedule" a next animation to play. There are two types of animations - looping and non-looping. You always want to change animations at the end, but looping animations don't trigger an On Finished event so you have to look for the first (or last) frame. I chose to look for the first frame because various looping animations could be different lengths. For animations that don't loop, you just need an On Finished event, and if no animation is scheduled while a non-looping animation is playing, then when it finishes, go back to idle.

    I figured that there may be situations where you just can't wait for the current animation to finish, so I made one that will always start immediately (the Die animation).

    You can get my sample here: http://www.rieperts.com/games/forum/AnimationSchedule.capx

    my sample doesn't queue up multiple animations... if the walk animation is playing and you quickly press jump and attack, it will switch directly to attack (or whatever the "NextAnimation" is set to when the current one ends). But if you want a queue, that wouldn't be hard to do.

    I was just discussing this with my son, and he reminded me that Spriter has built in animation blending - so you may want to check that out too.

  • luckyrawatlucky

    You could create a function to do that. Pass in the number entered by the user as a parameter, and then have the function pass back the string of numbers up to that value.

  • darkrealos

    the Every Tick sub event will only run on the tick when the mouse click event fires. You need to have it be a top level event. Set clickx and clicky to scrollx and scrolly at the start of layout so that it doesn't move the camera location until you click to make it move.

  • MomaFugger

    sounds like you have created an infinite loop

  • m0nkeybusiness

    The options are pretty limited - you can change the Type field of a TextBox to TextArea to get multiple lines (and then use CSS to make the background and border. Or use a sprite for the background and border and then place a text object on top of it. But then you need to know how much text will be displayed in advance, or resize the sprite after text has been set - using the TextHeight and TextWidth properties.

  • techkenb

    add another condition to the every random seconds that says sprite.count Less Than MaxSprites

    (where MaxSprites is the number you want to limit at)

    This will then only create a new instance of Sprite if there is less than the maximum number you want to allow.

    You don't need the Sprite.count greater than 2...

AllanR's avatar

AllanR

Member since 21 Nov, 2013

Twitter
AllanR has 23 followers

Trophy Case

  • 11-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Popular Game One of your games has over 1,000 players
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

20/44
How to earn trophies