|
Post by JLaCroix on Apr 6, 2004 8:27:05 GMT -5
Hi guys, I still need some help, thanks in advance! BTW Beta 1 of my RPG is done, so it won't be long now!!!
1.) I set up my game to use the joystick and it works fine, but is there a "joystick anykey" event? You still have to use the keyboard to scroll through text...
2.) I still have written down what you guys told me to make the enemies follow the player when you get close enough, but how do I make it so that the enemy shows the sprite for down if its moving downward, or up for upward while it's following the player?
3.) All the rooms are persistant, trust me there's no way around it. How do I make the enemies respawn? If the player kills them and comes back, they're gone.
4. Are there any sprites to make my character look like it's slashing a sword? Like something to put over the character in the attack event?
|
|
|
Post by megamushroom on Apr 6, 2004 10:16:06 GMT -5
1. No idea, sorry.
2. Use this in the draw event for the enemy.:
if direction=0{ sprite_index=//walk down sprite} if direction=90{ sprite_index=//walk right sprite} if direction=180{ sprite_index=//walk up sprite} if direction=270{ sprite_index=//walk left sprite here}
3. Have a variable, so if the enemy is alive, it is at 1, if it is dead, it is at 0. If the player enters the room and it is at 0, spawn an enemy, so in the creation code:
if enemythere=0{ create_instance(100,100,//enemy)}
or you can use, if the number of instances= number function. So if the number of enemies is below 12, create more enemies. if you only want a certain number of enemies, you can create the actual number of enemies minus the max number you want.
4. dont be lazy, make your own, lol.
hope this helps
|
|
|
Post by jlacroix on Apr 6, 2004 13:43:04 GMT -5
Thanks!!!
Does anyone else have any idea about the joystick thing?
|
|
|
Post by IsmAvatar on Apr 6, 2004 14:22:11 GMT -5
make a script, name it joystick_any
for(i=1;i<=joystick_buttons(argument0);i+=1){ if joystick_check_button(argument0,i) { return true } } return false
joystick_any(id) returns if any joystick buttons are being pushed. id is the id of the joystick (1 or 2)
|
|
|
Post by Jlacroix on Apr 6, 2004 14:26:41 GMT -5
I already have a script, for the dialogue, can I put that after keyboard_wait() ? THANKS!!!
|
|
|
Post by IsmAvatar on Apr 6, 2004 14:47:29 GMT -5
err, you can have more than one script. Scripts are resources. Just like objects, sprites, and rooms. You can make more than one script, just like you can make more than one sprite. You execute a script by calling its name like it were a function:
scriptname(arguments) and if it returns something, you may want to either test it, or save it in a variable: if scriptname(arguments) = 4 { /*do stuff*/ }
zz = scriptname(arguments)
|
|
|
Post by Jlacroix on Apr 6, 2004 14:51:18 GMT -5
I understand. I would rather keep this in one script though, in the dialogue script it waits for keyboard entry to advance to the next textbox, and I just want to know if I can put it there.
You are correct but however adding more scripts would make it more confusing than editing scripts I already have, this game is completely done now except for bug testing.
Can I put that in the dialogue script I have? (joystick_any) I mean.
Thanks!
|
|
|
Post by IsmAvatar on Apr 6, 2004 15:13:12 GMT -5
no, then I'd have to completely recode the script to enable it to work just anywhere.
I don't get it, why would anyone have only 1 script? I have 5 scripts, and my game has only just begun. It's like having only 1 object. It's possible, but insane.
Perhaps you're thinking of the wrong kinda script. Scripts are listed on the left, under the scripts tab, just like datafiles and paths are. The thing you put in an object and type in script there, that's a PIECE of CODE, not a script. A script is the action next to it, in which you can't type in code, you choose the script and then type the arguments.
|
|
|
Post by jlacroix on Apr 6, 2004 15:54:25 GMT -5
No, I have several scripts. I only want my RPG Dialogue script to be updated to use the joystick for text box scrolling. That's the only script I want to update. I have others for everything from collision detection to battling and using items. The script for dialogue is used by hundreds of objects, and I want the existing script to use the joystick so all those objects are updated without me having to go into them and tell them each to use the new script.
My dialogue script waits for keyboard keys to go, (keyboard wait) and I want to put (joystick_any) so that it does the same thing, but with the joystick.
I hope that helps you better understand. Thanks!
|
|
|
Post by megamushroom on Apr 6, 2004 18:31:39 GMT -5
cant you just execute the new script at the start of you existing script?
|
|
|
Post by IsmAvatar on Apr 7, 2004 12:14:12 GMT -5
Well, I'm at school and don't have the manual with me right now, but detect the id of the joystick, and store it in variable joy_id
joy_any = false for(i=1;i<=joystick_buttons(joy_id);i+=1){ if joystick_check_button(joy_id,i) { joy_any = true } } if (joy_any) { //do whatever if any joystick button is pressed. } else { //what to do if no button is pressed }
|
|
|
Post by JLacroix on Apr 7, 2004 14:32:14 GMT -5
Thanks! If that doesn't work I will post my script in question. Thanks!
|
|
|
Post by JLaCroix on Apr 8, 2004 8:14:45 GMT -5
Here is the script that I need to be able to use the joystick in: ------------------------------------------------------------------------
// Below deletes the collision object to avoid duplication with(objDistanceCheck) instance_destroy();
// Below draws the textbox on screen var _brush_color,_pen_color,_font_size,_font_color,_font_align; _brush_color=brush_color; _pen_color=pen_color; _font_size=font_size; _font_color=font_color; _font_align=font_align;
// Sets the size and colors of the text window brush_color=0; pen_color=c_white; pen_size=2; font_size=12; font_color=c_white; font_align=fa_left;
// Draws the text box draw_roundrect(view_current+50,view_current+475,view_current+(screen_width-50),view_current+350);
// Draws the character icon in the text box draw_sprite(argument0,-1,view_left[1]+60,view_top[1]+360);
// Draws the dialogue draw_text(view_left[1]+140,view_top[1]+360,argument1); // Perfect
// Clears text after it has been written screen_refresh();
// Readies the keyboard for next input io_clear();
// Waits until any button has been pressed to continue keyboard_wait();
// Resets the variables brush_color=_brush_color; pen_color=_pen_color; font_size=_font_size; font_color=_font_color; font_align=_font_align; // End of dialogue script -----------------------------------------------------------------------
|
|
|
Post by IsmAvatar on Apr 13, 2004 15:33:35 GMT -5
You haven't even tried to add in the joystick.
|
|
|
Post by jeremylacroix on Apr 14, 2004 8:20:10 GMT -5
That's because I don't know where to put it.
|
|