How would you script a bullet sprite to go from the edge of you're gun untill it hits something solid ie. a character or wall?
This is one of those questions that get asked over and over again. And it's more of a beginner's question, too. Please use the forum search and check the "read before posting"-stickie in the beginner's forum which contains many links to useful sites such as the Beginner's FAQ.
Well, you could use the "AreCharactersColliding" command, but I never found it very useful since it only compares baselines. I remember when I was working on my Death Orb arcade game (never finished but workable demo available here (http://www.vanwijst.com/games/invasion.zip)) I made target boxes out of character[].x and character[].y variables which triggered scripts in the repeatedly execute part of my global script (although the room script would work fine to if you planned to only have the shooting in one place). Something like:
if( (character[BULLET].x <= character[BADGUY].x+5) && (character[BULLET].x >= character[BADGUY].x -5)){
if ((character[BULLET].y <= character[BADGUY].y +10) && (character[BULLET].y >= character[BADGUY].y)){
script here (animation, change variables, blah blah blah)
}
}
....would make a target of 10x10 pixels at the foot of the bad guy. When the bullet's coordinates are inside that target, the repeatedly execute script would be triggered. It's a pretty simple way to construct a collision system. Of course with AGS 2.7+ character[].variables have been changed to something shorter....
....Unless you're thinking about making a shooting cutscene, in which case it would be a much simpler matter of just reading the manual and moving characters from A to B.
EDIT: Ah yes, a little research is never a bad idea either!
Sorry about this, but can an array be used as an index of collision?
I can't make heads or tails of your question, what do you mean by "index of collision"?
Sort of like checking every pixel of a character. I don't know why I said it like that. :=
Something like this (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=26307.0)? ;)
Of course how stupid of me. :D