How do I make sprite fall of edges

0 favourites
  • 8 posts
From the Asset Store
On the Edge is a puzzle game where you have 40 levels to have fun with.
  • Hi Guys.

    My first game (spaceship) consists of an outer space background and on top a coloured tile background. The idea I have is if any sprite leaves the coloured tile area it falls off into the outer space background and destroys.

    How can I achieve this please?

  • Are the two backgrounds the same size or is the colored tile one smaller?

    If the tile area is smaller and the intent is to have player keep ship on the tiles then you could use an event like: Is not overlapping tiles AND is overlapping space then destroy... if you want to create the illusion of falling in 2d you could shrink the spaceship as it "falls".

  • Excellent thanks. The tiled area is smaller. The ideally stays on the tiled area and rams enemies of the tiles into space. But, if the player doesn't handle the ship right they too can fall into space.

  • Sounds like a neat concept, did you get it working?

  • Hi. I did yes. But, I still have issues. Basically, both the player and enemy sprite should collide and bounce off each other in a way that the player is able to push the enemy of the edge and vice versa. Also, the enemy sprite should move towards the player sprite and have full 360 vision of the player without heading for the player and flying off the screen.

    goo.gl/photos/iiuNyvcUUVqEsgZW7

  • A couple of questions... if both player and enemy bump each other, how do you control which has more bump? Otherwise, they will eventually get into a stalemate. I envision the player causing 100% bump when he strikes enemy with his bump zone (aka front) and less so when not and same with enemy... with each "bump" causing both to rotate away so they have to reorient for next bump and thus can be advantaged/disadvantaged (I see a real cool multiplayer game on the same keyboard too).

    Also, what do you mean by "and have 360 vision of player"?

    One problem I foresee is you will have to have some sort of AI events. If you just use enemy go to the player location (and ram) the effect might not be very challenging.

  • try playing with the line of sight behavior. that would allow the enemy to locate the player. look into the platformer templates, there should be a bit of code that allows you to jump onto an enemies head, and when you land on their head it bounces you up a little bit and damages the character. you can manipulate that code, to say something along the lines of, IF Player Is On Collison with Enemy, AND Player is moving, (or Key Is Down, so it recognizes you're trying to ram them, unless you have a button for a ram attack, as "is moving" takes momentum into account, and you may never actually be still depending on physics and player setup) , set player position player.x +5 player.y+5, with player.x and player.y being the players current position, and the +5 adding 5 pixels to current location, effectively "bumping" said object. now as i said, look into the platformer template, as im not 100% thats the correct code, but it IS the correct wormhole to go down.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • that would be enemy.x and enemy.Y, where as if on collision and Not pressing a direction would cause player.x player.y to change, effectively bumping the player when rammed. you could also try to add a safeguard or sort of check, where enemy speed is attatched to a variable.boolean variable = attacking, If Attacking = False, set Enemy speed to 0, if attacking = true, set enemy speed to 100, every x seconds, Random(Range), toggle boolean. If Attacking = true, on collision, bounce player, if false, bounce enemy, OR, you could use something like the compare speed option, and on collision if enemy speed = >50 bounce player, else bounce enemy. also make sure your enemies are solid.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)