Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Gankkizz on Mon 20/10/2003 17:31:44

Title: Suggestion: "ChangeCharacterViewBackground"
Post by: Gankkizz on Mon 20/10/2003 17:31:44
I need this for my game. It could also be used to create 3D characters...
Title: Re:Suggestion: "ChangeCharacterViewBackground"
Post by: Scummbuddy on Mon 20/10/2003 17:37:37
I don't get what this would be used for? Don't we usually use the background as an invisible color around the characters?

What I'm saying is that I don't get what you want from this.
Title: Re:Suggestion: "ChangeCharacterViewBackground"
Post by: Gankkizz on Mon 20/10/2003 18:07:28
I'm making an adventure game with a 3D character. You can't make a 3D character in Ags because a character can only move into 8 directions. If there would be a function which changes the characters view non-blocking the character could move into 40 different directions (with 5 views)... I can't really explain this, atleast not in english since it's not my first language...
Title: Re:Suggestion: "ChangeCharacterViewBackground"
Post by: SSH on Mon 20/10/2003 18:31:51
Did it take you two tries to get the Counterstrike forum registration question right? :)

Why do you think that the existing functions to change a character's view are blocking anyway? You can change the view and then do otehr stuff with that view still set...

Title: Re:Suggestion: "ChangeCharacterViewBackground"
Post by: Gankkizz on Mon 20/10/2003 19:17:30
That's not what I meant... In my game the characters view changes almost all of the time, not just once in a while...
Title: Re:Suggestion: "ChangeCharacterViewBackground"
Post by: SSH on Mon 20/10/2003 19:22:30
So change it every game cycle then. I stil can't see why you can't use ChangeCharacterView.

Title: Re:Suggestion: "ChangeCharacterViewBackground"
Post by: Gankkizz on Mon 20/10/2003 19:32:37
Quote from: SSH on Mon 20/10/2003 19:22:30
So change it every game cycle then. I stil can't see why you can't use ChangeCharacterView.

Because I can't! You can't use ChangeCharacterView like that.
Title: Re:Suggestion: "ChangeCharacterViewBackground"
Post by: Ishmael on Mon 20/10/2003 19:38:18
Why? Has your mother told you not to do so? j/k, seriously, who stops? Has Al pointed you to the wrong direction also?
Title: Re:Suggestion: "ChangeCharacterViewBackground"
Post by: Gankkizz on Mon 20/10/2003 19:46:56
Try it for yourself, you can't use ChangeCharacterView on the same time with something else.
Title: Re:Suggestion: "ChangeCharacterViewBackground"
Post by: Ishmael on Mon 20/10/2003 20:02:30
Hey, the forum rules forbit insulting others directly, right? And, I belive everyone here should own even a little sense of humour, and so on... or something...

But, as this has not been asked before, AFAIK, how could I have known? How could have SSH?

This matter goes to CJ, we didn't code AGS... :P

----- EDIT -----

And, I'd like to add, respect your elders.
Title: Re:Suggestion: "ChangeCharacterViewBackground"
Post by: Scorpiorus on Mon 20/10/2003 20:05:13
I've just put...

int delay = 40;
function repeatedly_execute() {
 // put anything you want to happen every game cycle here
 
 if (delay<0) {delay=40;  ChangeCharacterView(EGO, character[EGO].view + 2);} else delay--;
}
 
...and it works fine.

Could you please explain what you mean with "use on the same time with something else"?

Basically, you need to check char's current direction and set his view accordingly via repeatedly_execute.

~Cheers
Title: Re:Suggestion: "ChangeCharacterViewBackground"
Post by: Gankkizz on Mon 20/10/2003 20:07:16
Sorry about that TK... I've had a bad day... Or something... :P
Title: Re:Suggestion: "ChangeCharacterViewBackground"
Post by: SSH on Mon 20/10/2003 20:07:37
Quote from: Gankkizz on Mon 20/10/2003 19:46:56
Try it for yourself, you can't use ChangeCharacterView on the same time with something else.

I'm afraid that that sentence doesn't make it clear what you are trying to do. I'm not trying to attack you, but could you please re-state the problem.

Are you saying that you can only change the view of one character per cycle?
Or that you can only change the view once per cycle?

Or something else?


EDIT:

It can be frustrating when things go wrong. It helps to sit down and try and explain a problem as fully as possible.
Title: Re:Suggestion: "ChangeCharacterViewBackground"
Post by: Ishmael on Mon 20/10/2003 20:13:28
That's nothing... no-one's dead, so it's all ok. I've read that untill certain age (somewhere between 15 and 20?) thinking is emotion-based, and then it turns to something more logical... it was a long time ago... Oops, I'm drifting off the topic here :P
Title: Re:Suggestion: "ChangeCharacterViewBackground"
Post by: SSH on Mon 20/10/2003 20:19:19
I noticed that the "usual suspects" turned up to help out on this thread. It makes me feel like the Powerpuff girls or something. I bags to be Buttercup. TK can be Blossom and Scorpiorus is bubbles.  ;D

CJ is professor Utonium

I think that was over-sharing  :-[
Title: Re:Suggestion: "ChangeCharacterViewBackground"
Post by: Pumaman on Mon 20/10/2003 21:16:09
I must admit, I don't understand the problem either, so feel free to re-word it if you like.
Title: Re:Suggestion: "ChangeCharacterViewBackground"
Post by: Gankkizz on Mon 20/10/2003 21:55:06
Well...

----------------------N
--------------NW 12345 NE
-------------12345----12345
-------W 12345----+------E 12345
-------------12345----12345
--------------SW 12345 SE
----------------------S

If the right arrow key is pressed, the current view is 3 (of the 5) and the direction is NE = the view is 4. If the key is still pressed = the view is 5. If the key is STILL pressed = the direction is E and the view is 1... and so on.

If the view is 3, the direction is N and the up arrow is pressed the character moves 3 pixels up. If the view is 4, the direction is N and the up arrow is pressed the character moves 3 pixels up and 1 left.

Or something...

Anyway, I can't get this to work. Is there some other way or...
Title: Re:Suggestion: "ChangeCharacterViewBackground"
Post by: Pumaman on Mon 20/10/2003 22:06:09
Ah, I see, so you're basically simulating 40 directions by using 5 different views for each of the 8 supported directions?

And using ChangeCharacterView resets the loop and frame to 0, which is why that doesn't work?

You could be sneaky and set the view directly. This is not normally recommended but it may be a workaround here.

Just do:

character[EGO].view = XX;

where XX is the view number minus 1 (eg. to set to view 3, set it to 2).

Title: Re:Suggestion: "ChangeCharacterViewBackground"
Post by: Gankkizz on Mon 20/10/2003 22:12:17
Thanks! :D You're the best CJ!  ;)
That's exactly what I was talking about! I'll try it out.
Title: Re:Suggestion: "ChangeCharacterViewBackground"
Post by: Scorpiorus on Mon 20/10/2003 23:21:33
Quote from: Pumaman on Mon 20/10/2003 22:06:09haracter[EGO].view = XX;
I happened to try it before and it didn't work. Seems like the char.view is one direction (read only) variable because AGS rewrites it with it's own value on each new update loop.

though the loop and frame work well: :P

// first saving the values:
int loop = player.loop;
int frame = player.frame;

ChangeCharacterView(EGO, <view>);

//now set 'em back

player.loop = loop;
player.frame = frame;

CJ, would it be possible for AGS to assume that the value of .view can be changed?

~Cheers
Title: Re:Suggestion: "ChangeCharacterViewBackground"
Post by: InCreator on Tue 21/10/2003 01:35:15
Ah, I'm dying to see that one :o
Title: Re:Suggestion: "ChangeCharacterViewBackground"
Post by: Pumaman on Tue 21/10/2003 20:34:31
QuoteI happened to try it before and it didn't work. Seems like the char.view is one direction (read only) variable because AGS rewrites it with it's own value on each new update loop.

Ah oops, yes of course. Scorpiorus' suggested workaround should do the trick though.

Quote from: Scorpiorus on Mon 20/10/2003 23:21:33
CJ, would it be possible for AGS to assume that the value of .view can be changed?

That won't work due to the current way the engine works - and also, it's generally bad practice, and the reason why Change and SetCharacterView commands are provided.
Title: Re:Suggestion: "ChangeCharacterViewBackground"
Post by: Scorpiorus on Tue 21/10/2003 21:17:25
Quote from: Pumaman on Tue 21/10/2003 20:34:31That won't work due to the current way the engine works - and also, it's generally bad practice, and the reason why Change and SetCharacterView commands are provided.
I see... just thought of some tricks with changing a view on the fly. :)

EDIT: wait a second, I think I found the way..... ;)

~Cheers