Character shadow

Started by Vel, Fri 30/05/2003 15:40:44

Previous topic - Next topic

Vel

OK, I want there to be a shadow when a character stands on the castle wall. I make a new character(upside down), use the SetCharacterTransparecy command...and it doesn't work. Here's the script:
Repeatedly execute:

while(character[ABBAT].walking!=0){
 MoveCharacter(SHADOW, character[ABBAT].x, 221);
 }


Interaction:

character[SHADOW].room=character[GHERKIN].room;
SetCharacterTransparency(SHADOW, 50);
SetGlobalInt(43, 1);
character[SHADOW].x=character[ABBAT].x;
character[SHADOW].y=221;
SetCharacterView(SHADOW, 35);
MoveCharacter(ABBAT, 11, 42);
Wait(300);

The shadow shows up, but doesn't move. Any suggestions?

Pumaman

Replace this:

Quote from: Vel on Fri 30/05/2003 15:40:44
while(character[ABBAT].walking!=0){
MoveCharacter(SHADOW, character[ABBAT].x, 221);
}

With this:

character[SHADOW].x=character[ABBAT].x;



Vel

Sorry Chris but it doesn't work. The shadow doesn't move, it just changes its place after the interaction cutscene. Any other ideas?

Scorpiorus

#3
A laggy shadow, Vel ;D

So it's a cutscene. That changes the things...

a bit of modifications:

Interaction:

character[SHADOW].room=character[GHERKIN].room;
SetCharacterTransparency(SHADOW, 50);
SetGlobalInt(43, 1);
character[SHADOW].x=character[ABBAT].x;
character[SHADOW].y=221;
SetCharacterView(SHADOW, 35);
MoveCharacter(ABBAT, 11, 42);
//instead of the code in the repeatedly execute:
while (character[ABBAT].walking) {
 character[SHADOW].x=character[ABBAT].x;
 Wait(1);
}


as about the code inside the repreatedly execute you do not need it anymore.

how is it turn out?

-Cheers

Vel

Yes! It is working!I've got a couple of questions about changing the shadow view, but I'll post the tomorrow. Im just too sleepy. Anyway, that was just the start.

Vel

Here's the illustration:


Vel

#6
Legend:
Yellow-

Red -

Purple/Blue - (Flipped)
Green -

Any Ideas how can I make this?

Scorpiorus

Do you mean the player have to walk ontop of the wall casting the shadow onto the ground?

Is it just for a cutscene or you want it during the gameplay too?

Vel

Yes, thats what I need. There are three hard parts though.
1)The shadow does not belong to the player character, so the player stands on region event doesn't work
2)movement on the wall:shadow movement on the ground=1:2
3)changing shadow views while the character is behind the stone slabs.

SSH

#9
Quote from: Vel on Mon 02/06/2003 17:39:17
Yes, thats what I need. There are three hard parts though.
1)The shadow does not belong to the player character, so the player stands on region event doesn't work
You need to modify the code inside the while loop to have:
if (character[ABBAT].x<FIRSTAREAx) {
  view=whatever;
} else if (character[ABBAT].x<SECONDAREAx) {
  view=whatever2;
} etc. etc. etc.

this is easyush because you're only moving in 1 dimension

Quote
2)movement on the wall:shadow movement on the ground=1:2

Use the multiplication operator?

Quote
3)changing shadow views while the character is behind the stone slabs.
see answer to number 1


EDIT: By the way, shouldn't the existing shadow of the wall have a gap corressponding to the archway?
12

Vel

I have a door as an object. Your second answer is not very clear to me.

Scorpiorus

Vel:
Here is a template I made (shadow_template). It's not a cutscene but you can easily make one by integrating the room's repeatedly execute code into:
while (character[ABBAT].walking) {
<..........>
<..here..>
<..........>
Wait(1);
}

Pay attention on how I used walk-behind mask (N1)  to hide the shadow (I think it's the most smoother way :P) The walkbehind baseline is set to the top of the screen so it shouldn't affect any other characters walking near the wall.

let me know what do you think

-Cheers

Vel


Synthetique

heheh... if it's only a cutscene then why don't you just animate the whole thing?

Vel

Oh. Yeah. SURELY an avi of a minute or so wont make the file size big.

Privateer Puddin'

compression is your friend

Synthetique

no need for avi... pcx is your friend..
just make a character being the ground and draw the shadows and put them in the view loops (like you put walkcycle pics in the views) and then manipulate from there..

Vel

Nah. This script works fine.

Scorpiorus

Quoteno need for avi... pcx is your friend..
just make a character being the ground and draw the shadows and put them in the view loops (like you put walkcycle pics in the views) and then manipulate from there..
Synth, it is actually how it's done. :) We have a character representing a shadow. But why we need to draw all possible positions of the shadow character? It's more simplier to have a formula to calculate it's location. As SuperScottishHero said, he have a particular situation when the character walks in 1-dimention. Of course the formula parameters may need to be adjusted to get more precision movement. Also having a bit more shadow sprites would make it more realistic. Finally such implementation still give the opportunity to use the shadow not just while the cutscene is running. ;)

-Cheers

Vel

Question: HOw can I create a walkbehind just for the shadow? There are two other characters on this screen and three other walkbehinds.

SMF spam blocked by CleanTalk