Powered by Invision Power Board

 
    Reply to this topicStart new topicStart Poll

> Im new to GML and am having some problems, Sprite issues to be specific
United States
maxfreak
Posted: Apr 9 2009, 01:19 PM
Quote Post


Regular
[*]

Group Icon
Group: Members
Posts: 196
Member No.: 3740
Joined: 7-May 07

Status: (0d) [--]


Heres a thread regarding this ive made on the GMC http://gmc.yoyogames.com/index.php?showtopic=427261

Well apparently it didnt work like i thought. Now Mario stops and faces in the direction like I wanted to, BUT his feet are still going through their running animation when I stop moving. wtf? Also I removed the "if" codes that Jumpy helped me fix and apparently those had no effect whatsoever! XD I removed them and it still did the same thing so the code never actually did anything in the first place.

Heres exactly everything I have for the Mario object.

user posted image

user posted image

The code thats in that event

user posted image

user posted image

And the code for that event

user posted image

I just want mario to stop and face in the direction of the last key pressed. So what am i missing to get it to do what I want it to? Thanks in advance.
PMEmail PosterYahooMSN
Top
India
Char
Posted: Apr 9 2009, 01:21 PM
Quote Post


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

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

Status: (0d) [--]


you need to stop the mario on the release key events
ie:
release left
if (speed < 0) speed += 0.25;
image_speed = 0;

release right
if (speed > 0) speed -= 0.25;
image_speed = 0;

assuming that's how "Move in a direction" works
Combining GML with DND is never a good idea.

This post has been edited by Char on Apr 9 2009, 01:24 PM


--------------------
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
Spain
Sergeant DeeY
Posted: Apr 9 2009, 01:24 PM
Quote Post


~Heh Heh~
[*][*][*]

Group Icon
Group: Members
Posts: 1344
Member No.: 4730
Joined: 17-November 07

Status: (0d) [--]


You should program it on the step event like this or you can do what char said

CODE
if keyboard_check(vk_right) and not keyboard_check(vk_left)
{
image_speed = 0.5
hspeed = <yourspeed> //Must be higher than 0!
sprite_index = right
}
if keyboard_check(vk_left) and not keyboard_check(vk_right)
{
image_speed = 0.5
hspeed = <yourspeed> //Must be lower than 0!
sprite_index = left
}
else
{
hspeed = 0
image_speed = 0
}


This post has been edited by Sergeant DeeY on Apr 9 2009, 01:25 PM


--------------------
The signature will not be available when the new forums shows up.
~~DeeY~~
PMUsers Website
Top
United States
maxfreak
Posted: Apr 9 2009, 01:37 PM
Quote Post


Regular
[*]

Group Icon
Group: Members
Posts: 196
Member No.: 3740
Joined: 7-May 07

Status: (0d) [--]


Cool, it worked char. Thank you and thanks Sergeant DeeY. Well now it works, but not it just stops on a random animation of Marios walking. Each walking direction has 2 subimages, the static is 0 and then the walking is 1. SOmetimes now the animation stops on 0 but mostly on 1. Im guessing I have to add an image_index command to get it to stop on the 0 subimage everytime?

EDIT:
Nevermind answered my own question. Thanks guys! Also I'll keep away from mixing DnD and code. I just found something that will help me smile.gif

This post has been edited by maxfreak on Apr 9 2009, 02:02 PM
PMEmail PosterYahooMSN
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.0430 ]   [ 14 queries used ]   [ GZIP Enabled ]   [ Server Load: 1.12 ]