EvolveTom's Forum Posts

  • 2 posts
  • Quick bump!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Curse you, forum! Had this all written up and then *poof* logged out.

    Aaanyhow, just starting to play with Construct, couldn't find answers to my problems and so, here I am. I'm prototyping a top-down soccer game, currently working on the most basic of features - getting the ball to behave like a ball, allowing two players on the field to pass it around and shoot it.

    Multiple questions.

    1. How do I get the ball to behave like a ball?

    I have the player set up with 8Direction movement. I also have two test balls: Ball1 uses 8Direction movement, while Ball2 uses Bullet movement. I currently have only a "kick" action assigned to the Space bar as I'm testing the level. I'd like the ball to do a few things that a real ball would do: slow down and come to a stop after a short time, bounce off solid objects like players.. and I suppose, at the end of the day, I'll want to also make it LOOK like there are some physics to the ball -- i.e. a lob pass would look like it's flying through the air.

    With the 8Direction ball, I have the ball match the player's VectorX and VectorY, and it sets the speed to Player1.8Direction.Speed*2. It decelerates as one would expect a ball to do, coming to a stop. The issue right now is that it doesn't bounce off solid objects, like the wall I have around the field. It basically just hits the wall and stops... or if it's kicked at an angle, it hits the wall and just slides along it.

    With the Bullet ball, I have the kick key set the ball's angle of motion to Player1.8Direction.MovingAngle, and also sets the bullet speed to a number relative to the player's speed. The ball bounces correctly off walls, but it doesn't stop. I tried to add an event where -- when the ball hits the wall -- its acceleration is multiplied by a negative number (i.e. to simulate deceleration), but that led to some weird movement... and if it hits two walls in quick succession, it's basically multiplying back to a positive number.

    2. What's the best way to set up my player sprites?

    In the long run I'm going to want 5 or more players per side on the field. There would be a couple of different core archetypes for players -- think like the old Ice Hockey game or Mutant League Football or whatever, with, for discussion's sake, a little fast player, a big and strong one and a balanced one. Further, each player would have its own stats that would vary, i.e. speed, power, jump height, etc. Should each of these be a tag? Should each one be its own distinct sprite? Should I just use instance variables to spawn a bunch of the SAME sprite with different attributes?

    3. How to simulate physics/height?

    Obviously if I'm just having the ball roll around on the ground it's pretty straightforward. But this is soccer, and sometimes the ball leaves the ground. How would you simulate a pass or shot where the ball is flying in the air in a top-down, 2D game? There's certainly the opportunity to just create a shadow below the ball... but... uhhh... the logic behind where that shadow is, how big it is, etc. is just kinda making my brain hurt right now. Also, the ball would presumably also need to take a different arc, rather than go straight to its target.

    4. How would I add a power meter?

    One question that just popped into my head that I haven't looked into yet. If it's already been answered on the forum, just point at me and go "YOU LAZY BUM!" and carry on. But basically: I want to set up a power meter, where the longer you hold the key, the harder the pass/shot/whatever is. Further, I suppose if you're running and you kick the ball, or if the ball is moving toward the player slowly, it's likely to be a harder shot. Just trying to wrap my head around the logic and how I'd go about actually setting this.

    Any advice appreciated!

  • 2 posts