Robsta's Forum Posts

  • The number on the left in the event editor should be the line number for the event. To see the total number on an event sheet, scroll to the bottom and see the line number of the last event.

  • This should do what you wanted it to do.

    example.capx

  • I don't know of any translation service built into construct, but I did just check and by using google translate I got the Japanese characters: テキスト, which I was able to display in a text field in Construct 2, just like any other text.

  • Thanks, this looks good! Now I just need to make a few minor modifications to deal with a psudo-3D and I'll be good to go.

  • So bullet has a nice behavior where it bounces off an object, using its angle of motion and the angle of the object that it's bouncing off.

    However I've been trying to make a pseudo-3D game in which I've determined, in order for physics to not be destroyed too badly, I need to keep the x/y/z coordinates + angle of motion of the objects in variables, then pass them through a relocation pass before the objects are drawn to the screen.

    This means that I can't use the bullet behavior, since it doesn't update the object variables which state where it actually is. The vast majority of the behavior is easy to implement via events, but the bounce off function is notably more complex. For example, how do you find the angle of the object it's bouncing off of if the bounding box of the object being bounced off isn't square?

  • floor takes a number and rounds it down to the nearest whole number.

    int converts a variable/number into an integer (which by definition, does not have decimal places, aka a whole number).

    So basically floor(3.14) gives a real number which is 3.00

    While int(3.14) gives an integer which is 3

  • While R0J0's answer is correct, I thought I'd take a moment to explain why this works.

    random(x) returns a random number between 0 and x, Including random decimal points. So therefore random(4) could return 0, or 1.75 or 3.14 or 1.1217597243 or whatever, as long as it's a positive number and below (but not including) 4.

    This is where the int() comes in. By using the int() expression he converts the number to one that does not have fractions, it's effectively the same as using floor(). 1.75 would become 1, 3.14 would become 3, and there are now only 4 possible numbers that int(random(4)) can produce: 0, 1, 2 or 3 (each with an equal chance).

    Now by taking this and multiplying it by 90, your possible angles for the bullet are 0, 90, 180 and 270, which does exactly as you wanted it to.

  • One note with my previous solution (a bug I found) -> if you happen to be just at the top of the stair case, so that you're overlapping the platform at the top, but you're still on the staircase, there's a small window (a couple pixels) that can cause you to fall through the stairs if you're going slowly.

    As for your other question: You could set the player's position to prevent the re positioning, but doing this could interfere with jumping. (If say, you added a re position to that same event, it would see that the player is near the ground and not pressing up, so therefore it would set the player to be standing on the ground unless they jump higher in 1 frame then your offset (= half the player's height right now).

  • Well if you take the events you have from your example and increase the offset it appears to work better.

    PlayerObject -> Is overlapping SolidTile at offset (0, PlayerObject.Height/2)

    is what I used, and it looked ok.

  • I'm not 100% sure what you're asking, but taking a look at things I think what you want is the player to go up the stairs if they're pressing the up key, and not to go up the stairs if they're NOT pressing the up key, to this question the answer would be:

  • I haven't done anything with twitch chat before, but I have used json and parsing a fair amount.

    So basically, json is just an encoded string with all the information you need arranged in a specific way (I've mostly only used it for arrays so this is what I'm basing that off of).

    Most (all?) objects in construct 2 can be turned into text via Object.asJson (Try creating a text field and setting the text to the .asJson for one of your objects to see what it looks like). This can later be loaded via a "set from Json" to effectively recreate the object. (I do this a fair amount to duplicate arrays over multiple players to make sure they all have the same leaderboard/player information etc.)

    But as this works like a charm getting objects from Construct to Construct, will it work for getting a string from twitch to construct? I don't know, you might have to parse the Json to get the useful information that you need.

    So onto parsing a string. For this you need to use the tokenat() function. Json, as I mentioned before, is just a string arranged in a specific way that can be parsed to get the information.

    For example, in the platformer example, the Json for the background is:

    {"c2":true, "w":{"x":0,"y":0,"w":1280,"h":1024,"l"5904914194331451,"zi":0,"hX":0,"hY":0}}

    As you can tell, it breaks the information up with commas, so if you wanted the width, tokenat(ThisJsonString, 3, ",") would give you:

    "w":1280

    And you could further parse that with tokenat(NewString, 1, ":") to get simply a string that is 1280. Now you've got the width.

    You could even put those in the same line: tokenat(tokenat(ThisJsonString, 3, ","), 1, ":") to get 1280 if you wish.

  • Personally I wouldn't use the platform behavior for flying, if I wanted a character to start flying I would likely disable the platform behavior from them, and enable 8 direction or bullet behavior (depending on how you like to do flying). However if you really want to use the platform, your best bet is to set gravity to 0 and disable default controls, then write your own controls for flying.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Apparently I lost by slowing down to nothing, but it wasn't clear on how to slow down or speed up.

    Had a good streak going too, like 50ish.

  • Hey guys, I've written and released another free game on Synaptop

    This time it's a space based Shoot 'em up with single player and multiplayer modes, as well as a tutorial and sandbox mode. Single player is a 16 wave campaign with 4 bosses and randomly upgrading enemies. Multiplayer is a challenge to survive as long as you can, with your opponent cunningly upgrading the enemies and bosses that you fight to destroy you.

    here are some screenshots!

    Again I got external pages for the game that can be found here

    As usual, I welcome any questions or comments regarding the game. Hope you all have fun playing it!

  • So I recently came across a big in the game that I'm programming and I figured it out, but I thought I would post my results here since the behavior isn't exactly intuitive.

    What happened was I had a player who automatically shoots every x seconds when they're alive, but I also wanted to allow the player to upgrade their shooting speed, so I have an event which looks sort of like this:

    Every 2.5/Player.Speed seconds, Player shoots their preferred weapon type.

    This worked great for me, but later I added functionality to restart the layout after the player is destroyed, however I ran across a problem, the player would never shoot once the layout was restarted. After a little testing I figured out why this was. After the player is destroyed, the event above tried to activate and calculated that it should happen every 2.5/0 = NAN seconds, so it stopped, permanently.

    To fix this I added an extra condition:

    for each Player, every 2.5/Player.Speed seconds, player shoots their preferred weapon type.

    This way, after the player is destroyed, the event is never called, so it never sets itself to stopping permanently. Now, I can restart the layout and the player will still shoot.