Powered by Invision Power Board

 
    Reply to this topicStart new topicStart Poll

> GM and Animation Problems
Unspecified
Treeki
  Posted: May 11 2007, 04:43 PM
Quote Post


He's adorable, you can't deny it. :<
[*][*]

Group Icon
Group: Members
Posts: 3307
Member No.: 2001
Joined: 5-April 06

Status: (0d) [--]


So Elite Charizard somewhat convinced me to try GM.. I wrote this GML script (part of a platform movement for Luigi- no collisions or vertical movement yet) but the animations glitch up. Help?

Create event:
CODE
{
//Animation Constants
c_standing = 1;
c_walking = 2;

//Direction Constants
c_left = -1;
c_right = 1;

//Init Variables
v_xspeed = 0;
v_dir = c_right;
v_anim = c_standing;

//Other Stuff
image_speed = 0.1;
draw_set_font(font0);
}

Step event:
CODE
{
//Check Keyboard Input
if keyboard_check(vk_left) v_xspeed -= 0.3;
if keyboard_check(vk_right) v_xspeed += 0.3;

//Execute Friction
if not keyboard_check(vk_left) and not keyboard_check(vk_right)
{
 if v_xspeed < 0 v_xspeed += 0.1;
 if v_xspeed > 0 v_xspeed -= 0.1;
 if (v_xspeed < 0.1)&&(v_xspeed > -0.1)&&(v_xspeed != 0) v_xspeed = 0;
}

//XSpeed too High?
if v_xspeed < -3 v_xspeed = -3;
if v_xspeed > 3 v_xspeed = 3;

//Execute Movement
x += v_xspeed;

//Select Direction
if v_xspeed > 0 v_dir = c_right;
if v_xspeed < 0 v_dir = c_left;

//Select Animation
if v_xspeed != 0 v_anim = c_walking;
if v_xspeed == 0 v_anim = c_standing;

//Draw Sprite :: Left
if v_dir == c_left
{
 if v_anim == c_standing sprite_index = sl_stand;
 if v_anim == c_walking sprite_index = sl_walk;
}

//Draw Sprite :: Right
if v_dir == c_right
{
 if v_anim == c_standing sprite_index = sr_stand;
 if v_anim == c_walking sprite_index = sr_walk;
}

//Debug Code
draw_text(60,60,'a');
}

The text also doesn't display, even though I made font0.
I've attached uploaded an EXE so you can see the animation problem.. sad.gif (couldn't attach - both EXE and ZIP said You cannot upload this type of file)
(And yes, I know Luigi moves a bit too fast. I'll fix that later.)

Also- What's up with filesizes? The EXE is 1.07MB but the GM6 is 8kb! unsure.gif


--------------------
untitled fangame
http://archive.mfgg.net/index.php?showtopic=242243
expected completion: ∞
PMEmail PosterMSN
Top
Finland
Ultramario
Posted: May 11 2007, 04:53 PM
Quote Post


Dan Dan Dan!
[*][*][*][*][*]


Group Icon
Group: Members
Posts: 11240
Member No.: 2164
Joined: 9-June 06

Status: (0d) [--]


The animation works well for me (except for the fact it's very slow).


--------------------
PMEmail PosterUsers WebsiteAOL
Top
Unspecified
Treeki
  Posted: May 11 2007, 04:56 PM
Quote Post


He's adorable, you can't deny it. :<
[*][*]

Group Icon
Group: Members
Posts: 3307
Member No.: 2001
Joined: 5-April 06

Status: (0d) [--]


QUOTE (Ultramario @ May 11 2007, 04:53 PM)
The animation works well for me (except for the fact it's very slow).

user posted image


--------------------
untitled fangame
http://archive.mfgg.net/index.php?showtopic=242243
expected completion: ∞
PMEmail PosterMSN
Top
Finland
Ultramario
Posted: May 11 2007, 05:00 PM
Quote Post


Dan Dan Dan!
[*][*][*][*][*]


Group Icon
Group: Members
Posts: 11240
Member No.: 2164
Joined: 9-June 06

Status: (0d) [--]


Nope. That doesn't happen when I run that exe you uploaded.


--------------------
PMEmail PosterUsers WebsiteAOL
Top
Unspecified
Treeki
  Posted: May 11 2007, 05:01 PM
Quote Post


He's adorable, you can't deny it. :<
[*][*]

Group Icon
Group: Members
Posts: 3307
Member No.: 2001
Joined: 5-April 06

Status: (0d) [--]


QUOTE (Ultramario @ May 11 2007, 05:00 PM)
Nope. That doesn't happen when I run that exe you uploaded.

All other GM opensources I've tried work fine..

BTW, here's GM6, if it helps:

Attached File ( Number of downloads: 7 )
Attached File  lqbs.gm6


--------------------
untitled fangame
http://archive.mfgg.net/index.php?showtopic=242243
expected completion: ∞
PMEmail PosterMSN
Top
Uruguay
EDGE
Posted: May 11 2007, 07:54 PM
Quote Post


I'll be back...
[*][*]

Group Icon
Group: Members
Posts: 2775
Member No.: 2518
Joined: 18-August 06

Status: (0d) [--]


so whats that you want?
the text to show and what else?


--------------------
"You've been playing Super Mario Sunshine. haven't you?"
~The Yoshi Army~Team 1-Up~MFGG Submissions~Ref~
PMEmail PosterMSN
Top
India
Char
Posted: May 11 2007, 08:11 PM
Quote Post


fad was bad
[M][*][*]

Group Icon
Group: Admins
Posts: 2123
Member No.: 2856
Joined: 25-October 06

Status: (0d) [--]


QUOTE (Treeki @ May 12 2007, 03:13 AM)
So Elite Charizard somewhat convinced me to try GM..

lol

For the animation glitch, I'd suggest changing image speed to 0.2 or 0.15 and see if it works. The draw_text and draw_set_font go into the draw event.
Oh, and about the file sizes... Go get GM7, make a blank .exe with one item and room...
...2.28MB!


--------------------
aa this broke


Make your own | If a level is breaking the rules, note the ID and PM me.
Reference (thanks Frogjester!)
PMEmail PosterUsers WebsiteAOLYahooMSN
Top
Uruguay
EDGE
Posted: May 11 2007, 08:24 PM
Quote Post


I'll be back...
[*][*]

Group Icon
Group: Members
Posts: 2775
Member No.: 2518
Joined: 18-August 06

Status: (0d) [--]


0.25 works ok tho...
This is what I wrote(so I dont have to upload the file xD)
Create event:
CODE
{
//Animation Constants
c_standing = 1;
c_walking = 2;

//Direction Constants
c_left = -1;
c_right = 1;

//Init Variables
v_xspeed = 0;
v_dir = c_right;
v_anim = c_standing;

//Other Stuff
image_speed = 0.25;
}

step event:
CODE

{
//Check Keyboard Input
if keyboard_check(vk_left) v_xspeed -= 0.3;
if keyboard_check(vk_right) v_xspeed += 0.3;

//Execute Friction
if not keyboard_check(vk_left) and not keyboard_check(vk_right)
{
 if v_xspeed < 0 v_xspeed += 0.1;
 if v_xspeed > 0 v_xspeed -= 0.1;
 if (v_xspeed < 0.1)&&(v_xspeed > -0.1)&&(v_xspeed != 0) v_xspeed = 0;
}

//XSpeed too High?
if v_xspeed < -3 v_xspeed = -3;
if v_xspeed > 3 v_xspeed = 3;

//Execute Movement
x += v_xspeed;

//Select Direction
if v_xspeed > 0 v_dir = c_right;
if v_xspeed < 0 v_dir = c_left;

//Select Animation
if v_xspeed != 0 v_anim = c_walking;
if v_xspeed == 0 v_anim = c_standing;

//Draw Sprite :: Left
if v_dir == c_left
{
 if v_anim == c_standing sprite_index = sl_stand;
 if v_anim == c_walking sprite_index = sl_walk;
}

//Draw Sprite :: Right
if v_dir == c_right
{
 if v_anim == c_standing sprite_index = sr_stand;
 if v_anim == c_walking sprite_index = sr_walk;
}
}

and draw event...
well I didn't know what you wanted to do with the text I supposed show the sprite luigi was using so I wrote this:

CODE

//This Under is so it shows Luigi's sprite, you can take it out after you
//Finish using the other code to see what sprite luigi is using, if you
//take htis out and leave the code under luigi will use no sprite
//so this is here as long as the code to show what sprite luigi is using is here,
//if you take the code under out this under here is useless
draw_sprite(sprite_index,-1,x,y)
//Debug Code, it Shows the Name of the sprite that luigi is using
draw_text(x,y+10,sprite_get_name(sprite_index))
//Also you dont need to set a font so show some text, see above there is no font set.


if you put that the font has no use so you can delete it if you want...


--------------------
"You've been playing Super Mario Sunshine. haven't you?"
~The Yoshi Army~Team 1-Up~MFGG Submissions~Ref~
PMEmail PosterMSN
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

  Topic Options Topic Options Reply to this topicStart new topicStart Poll

 




[ Script Execution time: 0.0567 ]   [ 14 queries used ]   [ GZIP Enabled ]   [ Server Load: 0.95 ]