Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: [Request / Listing] Rolling in gm6  (Read 1561 times)

0 Members and 1 Guest are viewing this topic.

_Link_

[Request / Listing] Rolling in gm6
« on: May 16, 2006, 05:07:43 pm »
Does anybody have a code that will do this:
When you walk uppwards and presses "A" link will roll.
You dont have to make the whole code, just upwards, then I can edit it for the rest of the directions
« Last Edit: February 09, 2012, 03:39:23 pm by Niek »
Logged
Re: Rolling in gm6
« Reply #1 on: May 16, 2006, 05:24:28 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 252
if (walking = 1 and keyboard_check(ord('A')) = 1 and sprite_index = spr_link_walk_left) then motion_set(180, speed);
« Last Edit: May 16, 2006, 05:31:33 pm by Master J »
Logged
The Legend of Zelda: The Spell Caster
Release Date: ?

I'm a faithful man! Don't be a whimp, fight for life.

Goodnight

Once and future Captain
Re: Rolling in gm6
« Reply #2 on: May 16, 2006, 05:32:20 pm »
  • With a Capital G
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 706
Try giving Link a variable called rolling which, when true, none of the other movement code will work.

When you press the roll button, and you're not in the middle of some other action such as a sword attack, set rolling to true, image_index to 0, and sprite_index to the rolling sprite for the direction he's facing.

In Step, if rolling is true, first check which way you're facing. I don't know if you use direction, or your own custom variable, but here my suggestion is to make two temporary variables.
Code: [Select]
var roll_x, roll_y;These will be how far you move relatively when you're rolling. If you're facing up, set roll_y to -4 and roll_x to 0. If you're facing right, set roll_y to 0 and roll_x to 4. And so on.

Then, check:
Code: [Select]
if place_free(x+roll_x, y+roll_y) {And if so, add roll_x to x, and add roll_y to y.
Code: [Select]
} else {Otherwise, you've hit a solid, so play a collision sound and set rolling to false and change back the sprite. Or if you want, you can keep rolling true so that you still can't move, and set the sprite to a fallen-over Link, and an Alarm that will make him stand up after half a second or so.

Lastly, in the Animation End event, if rolling is true then set it to false, and change the sprite back into standing.
Logged

_Link_

Re: Rolling in gm6
« Reply #3 on: May 16, 2006, 05:46:45 pm »
okey...thanks a lot
Logged
Re: Rolling in gm6
« Reply #4 on: May 16, 2006, 05:55:56 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6206
I made ages ago a rolling example for someone in alttp style enjoy.
http://www.rocketsoft.gm-school.uni.cc/uploads/alttp%20rolling%20example.gm6
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.131 seconds with 44 queries.