Sprite Sheets, and AoE effects, melee attacks

Get help using Construct 2

Post » Thu May 17, 2012 4:03 pm

Hello,

I just recently started using Construct 2 so this is all still a bit new to me. I have been able to figure out a lot of the things that I want to do via events and behaviors, but there are two little things that are still sort of dogging me at the moment and I hope someone might be able to point me in the right direction.

The first: sprite sheets. I could have sworn that I read somewhere that you can put in sprite sheets instead of individual pictures for your animated sprites (and the example pack even comes with some setup that way). However, I can't figure out how to actually put the sprite sheet in and make it work - whenever I try I just get a single sprite that displays the entire sprite sheet and I don't see anything in the animations screen that let me designate it as a sheet instead of a singular sprite.

The second: Area of effect attacks. I can launch a projectile, no problem. I can have it cause damage or destroy an object no problem. However, I tried to make a projectile that will launch to a spot where you click on the screen, and once it reaches that spot, I wanted it to explode and deal x damage to all monsters within a certain radius of that spot... However, I have had zero luck with this. Any suggestions would be greatly appreciated!

And the third: melee-ranged attacks. I get how to make projectiles and such deal damage, but I am stuck with how to make a melee-type attack, like a knife or sword. I just don't 'get' how to even really start with it or how to make the game know if a monster is within range and angle of the blade (assuming the player character is facing the monster).

So, any suggestions/feedback would be great! Thank you kindly.
B
19
S
6
G
5
Posts: 98
Reputation: 4,484

Post » Thu May 17, 2012 4:18 pm

AoE - just have big circle sprite spawn right where the projectile landed. Make the sprite as big as you want your AoE to be and everything within that circle will take damage. And obviously you're going to make that circle invisible.

Melee - create a rectangle, as big as you want your melee range to be, make it invisible and have it always in front of your character. Now if an enemy is overlapping that rectangle and the player presses the attack button, deal damage to that enemy.
B
33
S
12
G
7
Posts: 227
Reputation: 7,582

Post » Thu May 17, 2012 4:20 pm

Hey, thanks a lot for the quick reply, those are both very helpful!

Dumb question here: how do you make 'invisible' circles and rectangles?



Also, additional question if anyone knows the answer: can you make a 'save game' option to allow players to pick up where they left off?
B
19
S
6
G
5
Posts: 98
Reputation: 4,484

Post » Thu May 17, 2012 4:21 pm

If you want the damage to vary depending on how far the object is from it's center, you can make an animation that shows the circle expanding and compare the animation frame to the damage you want to cause.

Or just use the distance between the center circle and the object to calculate the damage.
B
106
S
35
G
36
Posts: 792
Reputation: 24,703

Post » Thu May 17, 2012 4:25 pm

When you have an object selected, under Properties you'll have the option to select the initial visibility. You can also change the visibility of an object with events in the event sheet.

As for your save game question:
http://www.scirra.com/forum/save-game-score-on-a-server_topic51098.html
http://www.scirra.com/forum/webstorage-save-game_topic46118.htmlKFC2012-05-17 16:27:39
B
33
S
12
G
7
Posts: 227
Reputation: 7,582

Post » Thu May 17, 2012 4:31 pm

Sprite sheet -> Right click on the 'Animation frames' window and 'Import sprite strip'.

http://www.scirra.com/manual/53/import-sprite-strip/page-1
B
54
S
28
G
18
Posts: 1,520
Reputation: 24,990

Post » Thu May 17, 2012 5:01 pm

Thanks for the great answers everyone! I got most of those issues figured out now thanks to you.

I was able to get the sprite sheet imported no problem. But I did run into a couple of things I need to fiddle with:

1.) The animation doesn't loop; it just plays once and then stops. I have the Loop option set to loop so it -should- play continuously... but it doesn't.

2.) Is there a way to make the player graphic -not- rotate when its moving? I would like to be able to move in any direction like top-down but I don't want the character graphic to spin, and instead use different animations (I can do this part, looking at the example from the space shooter game).

I really do appreciate all the help. Thanks a lot!
B
19
S
6
G
5
Posts: 98
Reputation: 4,484

Post » Thu May 17, 2012 5:28 pm

As you said, the loop option in the animation should make it loop.
Post the capx (upload it to dropbox).
There's probably an issue in the setup, or you used a "on animation end" event that "blocks" the animation or something.


For the 2.) I guess you're using the 8 directions behavior, and set you should set its "Set angle" property to "No".
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Thu May 17, 2012 6:54 pm

Alright so after closing and re-opening Construct 2, the animation now loops properly.

For #2: Yes, using 8 direction behavior. I set the angle property to 'No", and that works.

Now I want to make it so if I hold down the right mouse button, the player moves towards that direction, but I can't seem to make that happen without having the player's graphic rotate. Is there a way to have the player move in that direction but the graphic remains in place?

My ultimate goal is to have 8 direction animations (up, down, left, right, then the isometric NW, NE, SW, and SE directions). If the player is moving up, then the 'up' animation is used, if the player is moving down, then the 'down animation is used' and so forth in 45 degree increments as appropriate. I get how to set that in the events using the keyboard, but no clue how to do that with the mouse.
B
19
S
6
G
5
Posts: 98
Reputation: 4,484

Post » Thu May 17, 2012 9:39 pm

I guess what you'd have to do is compare the x and y distance between the character and the mouse when clicked and then figure out what's the optimal combination of movement directions to get to that position.

So for instance, your character is at 0,0 and you clicked at 100,100 obviously you're character will be moving with the SW direction (at 135).
Now if you want to get from 0,0 to 100,50 you'd use 135 direction to get your y to 50 and for the rest of x use the 90 movement.


Hope this idea helps and if anyone has a better solution I'm sure they'll post it here.KFC2012-05-17 21:41:35
B
33
S
12
G
7
Posts: 227
Reputation: 7,582

Next

Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, jeffige, LeFuji, plinkie, Radulepy and 0 guests