How do I make sprite fall of edges

Just started using Construct 2? Post your questions here

Post » Sat May 20, 2017 12:31 am

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?
B
5
S
1
Posts: 9
Reputation: 343

Post » Sat May 20, 2017 1:41 pm

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".
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
65
S
17
G
8
Posts: 635
Reputation: 9,331

Post » Sat May 20, 2017 2:07 pm

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.
B
5
S
1
Posts: 9
Reputation: 343

Post » Mon May 22, 2017 4:49 pm

Sounds like a neat concept, did you get it working?
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
65
S
17
G
8
Posts: 635
Reputation: 9,331

Post » Mon May 22, 2017 5:39 pm

Message: wakd can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
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.
https://goo.gl/photos/iiuNyvcUUVqEsgZW7
B
5
S
1
Posts: 9
Reputation: 343

Post » Thu May 25, 2017 3:14 pm

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.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
65
S
17
G
8
Posts: 635
Reputation: 9,331

Post » Thu May 25, 2017 6:48 pm

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.
B
22
S
12
G
1
Posts: 108
Reputation: 2,774

Post » Thu May 25, 2017 6:53 pm

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.
B
22
S
12
G
1
Posts: 108
Reputation: 2,774


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests