Help with events

For questions about using Classic.

Post » Sat Oct 02, 2010 10:30 pm

Hey, noobie here... I have a couple of questions for you guys. Is it possible to make a sprite follow another sprite? I can't seem to find the action(s) for it. I heard you needed some special coding program for that or something. :| Also, can I make it so that there can only be a number of a certain sprite on the screen? Thanks peoples!
B
1
G
2
Posts: 6
Reputation: 637

Post » Sat Oct 02, 2010 11:00 pm

this?
Always: set Sprite.XY=Sprite2.XY
but it means that one sprite would be over another.

if you mean follow like one character to another, then i think you could write 1st sprite positions to variables or array. Or 1st sprite can spawn objects then 2nd sprite would follow by this path.

To have limited count of similar sprites you can use
1 "if sprite.count greater or equal to XX then stop, else spawn more"
2 "if sprite.count greater than XX then destroy one (by random or by some pick)"
B
19
S
6
G
4
Posts: 171
Reputation: 2,507

Post » Sat Oct 02, 2010 11:37 pm

With path finding:
http://dl.dropbox.com/u/6660860/followw ... inding.cap

In this example the follower sprite has the RTS behavior attached, and is always commanded to move towards the player. Note the wall has the solid attribute checked, this tells the RTS behavior to avoid it.

Without path finding:
http://dl.dropbox.com/u/6660860/follownopathfinding.cap

This has no path finding OR collision detection, you can do the same thing with collision detection using the Custom Movement behavior and the bounce action.
B
7
S
2
G
4
Posts: 164
Reputation: 2,418

Post » Sun Oct 03, 2010 12:33 am

@Nugman Can you explain to me how you did "Always: set Sprite.XY=Sprite2.XY" please? I'm kinda new at all this stuff. I'm attempting to make a short Metroid game. I'm making a charge beam attack, but I don't know how to. I made the animation, now all I need to do is make the charge beam sprite overlap the arm cannon of the sprite (Samus).


@Citnarf Oh, I'm sorry... What I meant was I want the follower to always be overlapping the sprite, not following in it. Thanks though, this might come in handy for the future.

EDIT: Nevermind guys! I got it :) But can you explain to me how I can make it so that only ONE of a certain sprite can be on the screen?
B
1
G
2
Posts: 6
Reputation: 637


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 8 guests