Page 1 of 2

Project 'R'

PostPosted: Sat Feb 25, 2006 11:09 am
by DilloDude
Currently I am working on a cool game project, and it is coming along very well. I have a few questions, though:

1: When typing a string into a function such as strcpy, can I make it go down a line, and if so how?
eg. 'I am typing a text and I am coming to the end of a line so I will move
down a line and continue typing.'

2: Also typing a string for something like the text someone says that includes a string variable in it. For example if you had a string 'name' that was set to 'Fred', could you type something like
Code: Select all
strcpy(text, "Hello,"name", how are you?)
and it would say Hello, Fred, how are you?

3: Now, a question on making a place to type a text such as 'name' in, like the beginning of a game. So you say 'new game' and it asks your name. I can do it with about half a bazillion 'key down' events, but could I get it to use only one (without half a bazillion 'if' statements) and have the backspace key work properly (as opposed to having it clear the whole string)?

4: When using activation regions and you destroy an actor (say an enemy) in one, then move to a new region, when you return to the original region, will the enemy come back? Is there a good way to do this?

5: Last, but not least, Is there a good way of saving the EXACT state of a game and loading it again in the EXACT same way (number of enemies of which type etc.) (and if I wanted you to start off in a certains spot (like the beginning of the level) I could either have it save there, or have it move you to those coordinates when you are created, and you could keep your progress in the level such as items collected)?

PostPosted: Sat Feb 25, 2006 11:35 am
by Novice
1.use "\n" it will jump to a new line

2.Use
Code: Select all
sprintf(youractor.text, "Hello %s", stringvar);


3.Use a text actor with input on

4.It's easy to check, so do it.:wink:

5.The only, way as far as i know, is to save variables. You can do what you want by usin multiple variables wich will store player position (x,y) stats (health, lives...) enemy's left and so on.

PostPosted: Sun Feb 26, 2006 4:06 am
by DilloDude
Thanks for that, It is really helpful.
With the activation region, It resets position of actors when you enter it, but ones that are desroyed stay destroyed. Now, I could have when you enter it, it goes through an array of x and y coordinates and creates different actors there, but it would be a pain, especially for large areas.

PostPosted: Sun Feb 26, 2006 9:39 am
by Novice
Try puting x and y coordinates in a file i think it will be much easier that way look at this thread http://game-editor.com/forum/viewtopic.php?t=1605

PostPosted: Tue Feb 28, 2006 9:56 am
by DilloDude
Ok, another problem. When you open a chest, and exit the activation region, when you return, the chest is closed again. I have tried a timer after the chest is opened to destroy the chest and create an actor that looks like an open chest. But, because it is used in a create actor function, exiting the region destroys it. I just thought maybe I could have it originally there, and use visibility state, but would it remember it was visible (or invisible) when re-entering the activationa region? I will test that...

PostPosted: Tue Feb 28, 2006 10:01 am
by DilloDude
No, it goes invisible again.

PostPosted: Tue Feb 28, 2006 7:21 pm
by makslane
Use a variable to control the chest (chestOpen) and use saveVars and loadVars to keep the correct state

PostPosted: Tue Feb 28, 2006 11:43 pm
by DilloDude
The problem is, I need an actor variable, and those can't be saved.

PostPosted: Wed Mar 01, 2006 12:54 am
by DilloDude
I thought of a solution to making the enemies etc. reappear when I re-enter the region: for ones you want to reappear, instead of destroying them, use visibility state and event disable. It should not remember these, and will reset them as if nothing had happened. For things you DO want to stay destroyed, you cn still destroy them.

Now, back to the chest problem...
I could have you close them again and have the orginal actors destroyed and under them have a closed animation (with the same physical response). I would use the open animation but for having the lid sticking out. But then you couldn't see if you'd opened it already, unless it had a slightly different animation (say with a tick mark over it) that took up the same space. It would be nice to have it stay open though.

PostPosted: Wed Mar 01, 2006 10:21 am
by Novice
If you dont have many chests (or you do have many but its not a problem for you to do it :wink:) you can use an array that will hold the chests states. 1 for open and 0 for closed. If this is a global array you should have no problem. It would look something like
chest[1]=1
chest[2]=0
chest[3]=0
chest[4]=1
chest[5]=0
...
And you could simply save this one variable each time you exit an activation region and reload when you reenter.

PostPosted: Wed Mar 01, 2006 11:02 am
by DilloDude
But how would that go for clones? I'd need each clone to have it's own, and that gets difficult...

Or would I go
Code: Select all
chest[1]=HealthChest.0.chestOpen;
chest[2]=HealthChest.2.chestOpen;
chest[3]=BombChest.chestOpen;
chest[4]=BombItemChest.0.chestOpen;
...

:?:

PostPosted: Wed Mar 01, 2006 5:27 pm
by Novice
Yeah it gets difuicult, there arent always automated ways to do something there is some footwork requierd. As for clones i really dont know, i would have to try it out but i dont have the time, sorry.

PostPosted: Wed Mar 01, 2006 11:07 pm
by DilloDude
It doesn't like having 'chest.1.chestOpen' etc. It has an error message that says Incompatible types: cannot convert from 'struct' to 'long int'.

PostPosted: Fri Mar 03, 2006 6:54 am
by DilloDude
Does anyone know how I can solve this?
Because it gets really annoying if you can get 300 swords, 42 billion boomerangs, infinite money and throw ten bombs at once(you could throw more, but you can only carry ten at a time).

PostPosted: Fri Mar 03, 2006 10:48 am
by makslane
To access a clone you must use the getclone function:
http://game-editor.com/docs/script_refe ... m#getclone