Hi rebenely. I'm not as experienced as other members here so I hope this helps a little.
TIMER & RESPAWN PARTSThere are 2 reasons the timer won't work:-
1. You created the timer under Character's
Collision Finish Event. You've done the first stage for timer creation but you've missed out the second part, which is to actually
add a timer event for this timer you've created (named:
respawn), like so:
a) Right mouse click
Character >
Actor Control (make sure Character is selected) >
Add >
Timer > Respawn (periodic, 3000ms) >
Add Action >
Script Editor
b) This will bring up script editor for event:
Character->Timer(respawn)c) This is where you need to put your respawn code (positions for character and all)
2. Even if you do everything in 1, it still won't work right because the
timer (respawn) belongs to
Character so when you destroy the
Character (collision finish event) the
timer (respawn) dies with it and doesn't do the 3000ms but would immediately do the respawn as next code line after it, thus respawning your Character immediately upon destroy. In your current code
(Collision Finish Event) it just creates the timer, ignores it (since no event atttached to timer) and does the respawn immediately.
So basically you need another separate actor to be responsible for the respawning (so timer won't be prematurely destroyed).
MOVEMENT & BULLET PARTS3. Firstly, might be better to use one script for all of those movements. One way is use 'Anykey' for KEY DOWN EVENTS and detect which key is pressed using gE's GetKeyState like so:-
- Code: Select all
char *key = GetKeyState();
Now 'key' holds whatever the key pressed was.
You can check for which key is pressed like so:-
- Code: Select all
if(key[KEY_LEFT]) // check if key pressed was LEFT
{
// your code (e.g. x-=2; )
}
or for two keys, like so:-
- Code: Select all
if(key[KEY_LEFT]&&key[KEY_UP])
{
// your code (e.g. x-=2; y-=2; )
}
4. For the bullet your 'If' statements are messed up. Have you considered using angle and directional velocity, search the forums for them or might find that doing the bullets under the above method (AnyKey) might work too (depends on how you code it).
There are other ways search the forum or check out gE's script reference:
http://game-editor.com/docs/script_reference.htmSorry for the rushed response (getting very late). Hopefully, other members more experienced then me will be able to help you further.
I like the graphics you've used. Good luck and let us know how it goes with the game