Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411525 Posts in 69377 Topics- by 58431 Members - Latest Member: Bohdan_Zoshchenko

April 28, 2024, 03:27:59 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityTownhallForum IssuesArchived subforums (read only)TutorialsGame Maker Tuts
Pages: 1 ... 4 5 [6] 7 8 ... 24
Print
Author Topic: Game Maker Tuts  (Read 355629 times)
Sengir
Level 0
***



View Profile WWW
« Reply #100 on: February 24, 2009, 12:45:28 PM »

hi! I got some problems with the animations of my char...my game it's a platform, when my char make a step and I'm holding "right" button it doesn't make the cycle of walking but keep the first frame of the animation, and when I release the button the cycle start...how can I fix it? thank yoU!!!!
Logged

Ataraxia
Level 0
**


View Profile
« Reply #101 on: February 24, 2009, 12:53:14 PM »

hi! I got some problems with the animations of my char...my game it's a platform, when my char make a step and I'm holding "right" button it doesn't make the cycle of walking but keep the first frame of the animation, and when I release the button the cycle start...how can I fix it? thank yoU!!!!

Post your movement code so we can have a look and see whats going on.
Logged
Sengir
Level 0
***



View Profile WWW
« Reply #102 on: February 25, 2009, 04:00:04 AM »

this is a part of the code that I put in the step event of the char:


if (keyboard_check(vk_right))
{
    sprite_index=run_right
   
}


when I'm holding the right button, the software shows only the first subimage..reading around I see that's caused by the sprite_index, every clock it is set =0...but how can i start the animation and make it ends when I release the button?
Logged

Ataraxia
Level 0
**


View Profile
« Reply #103 on: February 25, 2009, 09:25:00 AM »

this is a part of the code that I put in the step event of the char:


if (keyboard_check(vk_right))
{
    sprite_index=run_right
   
}


when I'm holding the right button, the software shows only the first subimage..reading around I see that's caused by the sprite_index, every clock it is set =0...but how can i start the animation and make it ends when I release the button?

Rather than having that code in the step event of your character, put it into a draw event and modify the code so it looks like this:
Code:
if (keyboard_check(vk_right))
{
    draw_sprite(run_right,-1,x,y)
   
}

Now what this means: If the right key is pressed, draw the sprite 'run_right' with its current sub-image at position x,y. There's one draw back to doing this, you'll have to also add some code in the draw event to draw your idle sprite when no keys are pressed. Hope that helps.
Logged
Sengir
Level 0
***



View Profile WWW
« Reply #104 on: February 25, 2009, 10:10:57 AM »

I did like you sayd but doesn't work :-( can i post my .gmk file? the problem is that the animation has 6 subimages...and it shows me only the first..

here my file
http://www.studioindigo.it/scambio/THE HORDE.zip

thank you very much for helping me!!! sorry for all my questions but I'm very new with game maker :-)
Logged

Ataraxia
Level 0
**


View Profile
« Reply #105 on: February 25, 2009, 10:51:34 AM »

Okay I had a look at what you've been doing. Part of your problem is that you have more than one event changing your sprite at the same time. So take this out of your Step event:

Code:
if (keyboard_check(vk_right))
{
    sprite_index=run_right
   
}

Add this to a Draw event:

Code:
if (keyboard_check(vk_right))
{
    sprite_index=run_right
    draw_sprite(sprite_index, -1,x,y)
   
}

And remove the 'Change Sprite' sprite action from your key_right event. After that everything should work. But you'll have to do the same for all your movements, for example: left, right, jumping, standing and so on.
Logged
salade
Level 4
****



View Profile
« Reply #106 on: February 25, 2009, 01:43:25 PM »

just check to see if the sprite isn't already your sprite.
Code:
if (keyboard_check(vk_right)*!(sprite_index == run_right))
{
sprite_index = run_right
}

remember: you don't need an if loop to test booleans. using them without if loops, in certain cases, becomes really intuitive.

good luck, and have fun!
« Last Edit: February 25, 2009, 01:57:19 PM by salade » Logged
Ataraxia
Level 0
**


View Profile
« Reply #107 on: February 25, 2009, 01:49:00 PM »

^^^

Nice! I'm assuming '*' is the same thing as 'AND'?
Logged
salade
Level 4
****



View Profile
« Reply #108 on: February 25, 2009, 02:16:45 PM »

Well...

the technical answer is no, * means multiply, while AND (I like to use &&) means and. however in this case AND and * do the same thing. since game maker treats variables so forgivingly, it doesn't really return true or false, but 1, or 0.  (keyboard_check(vk_right)&&sprite_index != run_right) would look better though, although in this case it's not that important.
Logged
Ataraxia
Level 0
**


View Profile
« Reply #109 on: February 25, 2009, 02:23:25 PM »

Cool, thanks for the answer. I'm new to the whole programming thing, so new info is always nice.
Logged
Sengir
Level 0
***



View Profile WWW
« Reply #110 on: February 26, 2009, 01:48:29 PM »

thanks guys, i'm fixing it with all the animations...now is working!!!
Logged

pixeltao
Level 1
*



View Profile WWW
« Reply #111 on: March 03, 2009, 05:05:10 PM »

About the Seamless Screen-Scaling. It seems to conflict with the screen saver/windows log-on screen. When the Windows log-on screen pops-in the surface is lost and the game crashes... Any idea how to prevent this? Thanks!
Logged

ChevyRay
Guest
« Reply #112 on: March 03, 2009, 07:18:43 PM »

In the event to draw the surface, have the game check that the surface exists first...

So, your begin-step would look like this:

Quote from: screen_begin
// this draws the surface on the screen
surface_reset_target();
if surface_exists(screen)
{
  draw_clear(0);
  draw_surface_stretched(screen,screen_x,screen_y,screen_w*screen_scale,screen_h*screen_scale);
  screen_refresh();
}else{
  // put code to re-create the surface here
}

Because when the resolution changes, or the screen saver pops up, the surfaces are cleared from video memory (the GM Manual mentions this). This way, if the surface doesn't exist, it'll recreate it. Also, do the same thing with the end step, when the surface target is set to the screen.

Sorry I'm lazy and didn't write out the whole code.
Logged
pixeltao
Level 1
*



View Profile WWW
« Reply #113 on: March 03, 2009, 09:52:31 PM »

Haha, no need to be sorry about the laziness, you helped me a lot! It worked, thanks ChevyRay!
Logged

ChevyRay
Guest
« Reply #114 on: March 03, 2009, 10:37:23 PM »

<3

Feel free to PM me as well if you have any other problems. Sometimes I forget to check back here.
Logged
Hedenius
Level 0
**



View Profile
« Reply #115 on: April 01, 2009, 10:39:28 AM »

The search function on the GMC is useless!

Anyway, i'm looking for a good room transition tutorial (a'la Metroid). I got the basics down but i wan't to see how others have done it!

Thanks in advance!
Logged
pgil
Guest
« Reply #116 on: April 01, 2009, 04:16:40 PM »

http://gmc.yoyogames.com/index.php?showtopic=362339&hl=transition

Has a bunch of examples. One of them is Metroid-style. I haven't looked at the code, so I don't know how practical it is to use, but it looks right  Beer!
Logged
KonamiCode
TIGBaby
*


View Profile
« Reply #117 on: April 03, 2009, 05:10:39 PM »

I actually just started looking at some of this guy's room transitions...he's done quite a few, they're linked in this post:
http://gmc.yoyogames.com/index.php?s=&showtopic=426099&view=findpost&p=3111749

Pretty neat, though I'm still trying to decipher some of the ways he does stuff.

One question I had, I saw that you guys were suggesting above to change sprites in the draw event. Any reason why you'd do it there over the step event? 
Logged
Super_Stalin
Level 0
*


View Profile
« Reply #118 on: April 28, 2009, 11:23:25 PM »

I am making a game in GM and i want to have lights that are more transparent around the edges then in the center, like a gradient.
Logged
ஒழுக்கின்மை (Paul Eres)
Level 10
*****


Also known as रिंकू.


View Profile WWW
« Reply #119 on: April 29, 2009, 12:26:15 AM »

use additive blending, draw_circle_color, with the center colored (say, white) and the edge color black.
Logged

Pages: 1 ... 4 5 [6] 7 8 ... 24
Print
Jump to:  

Theme orange-lt created by panic