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: [Example / Listing] Prioritized Movement used on Sage of Darkness  (Read 2232 times)

0 Members and 1 Guest are viewing this topic.
[Example / Listing] Prioritized Movement used on...
« on: May 14, 2006, 11:29:30 am »
  • Sage of Darkness
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 19
Its the engine that i made for Sage of Darkness.
Give Credit for Silverlink for this engine.. Its the first engine wrote evah.

Code: [Select]
/*----------------------------------
 Prioritized movement
 by silverlink
 Give credit please
----------------------------------*/
// assigning the keys
kup = keyboard_check(vk_up); // kup is keyboard_check(vk_up)
kdown = keyboard_check(vk_down); // kdown is keyboard_check(vk_down)
kleft = keyboard_check(vk_left); // kleft is keyboard_check(vk_left)
kright = keyboard_check(vk_right); // kright is keyboard_check(vk_right)

//Direction setup
if (direction=0){sprite_index = spr_link_right; image_speed=0.5;}
if (direction=90){sprite_index = spr_link_up; image_speed=0.5;}
if (direction=180){sprite_index = spr_link_left; image_speed=0.5;}
if (direction=270){sprite_index = spr_link_down; image_speed=0.5;}

//Walking setup with collision checking
if (kright = true && !kdown  && !kup  && !kleft && place_free(x+5,y)){direction=0; speed=5;}
if (kup = true && !kleft  && !kright  && !kdown && place_free(x,y-5)){direction=90; speed=5;}
if (kleft = true && !kright  && !kdown  && !kup && place_free(x-5,y)){direction=180; speed=5;}
if (kdown = true && !kup  && !kleft  && !kright && place_free(x,y+5)){direction=270; speed=5;}
if (kup && kright = true && !kdown  && !kleft && place_free(x+5,y-5)){direction=45; speed=5;}
if (kup && kleft = true && !kdown  && !kright && place_free(x-5,y-5)){direction=135; speed=5;}
if (kleft && kdown = true && !kup  && !kright && place_free(x-5,y+5)){direction=225; speed=5;}
if (kright && kdown = true && !kup  && !kleft && place_free(x+5,y+5)){direction=315; speed=5;}

//activating collision checking
if !place_free(x+5,y) && !place_free(x-5,y) && !place_free(x,y+5) && !place_free(x,y-5){image_speed=0; image_index=0; speed=0;}
if !place_free(x+5,y+5) && !place_free(x-5,y-5) && !place_free(x-5,y+5) && !place_free(x+5,y-5){image_speed=0; image_index=0; speed=0;}

//Standing still
if !kright && !kup && !kleft && !kdown{image_speed=0; image_index=0; speed=0;}

// When all buttons are pushed
if kright && kup && kleft && kdown{image_speed=0; image_index=0; speed=0;}

 
« Last Edit: February 09, 2012, 03:37:35 pm by Niek »
Logged
Member of ZFGC since the EZboard Days

Goodnight

Once and future Captain
Re: Prioritized Movement used on Sage of Darknes...
« Reply #1 on: May 15, 2006, 08:22:59 pm »
  • With a Capital G
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 706
Not bad at all for a first engine. I haven't tested it, but can tell from reading that it would work fairly well.

I don't want to re-write it or anything, but I could give you a few tips to optimize that if you'd like.
Logged
Re: Prioritized Movement used on Sage of Darknes...
« Reply #2 on: May 16, 2006, 01:07:20 am »
  • Sage of Darkness
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 19
well this ain't the latest version of the script.
if your intrested i can show you the latest version.
just add me on msn: Send PM first
« Last Edit: August 29, 2006, 12:07:42 pm by silverlink »
Logged
Member of ZFGC since the EZboard Days
Pages: [1]   Go Up

 


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



Page created in 0.016 seconds with 40 queries.