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: Log Movement Script  (Read 1279 times)

0 Members and 1 Guest are viewing this topic.
Log Movement Script
« on: September 23, 2007, 08:57:47 pm »
  • The king of Awesome
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 198
Sprites Used:
GokuD
GokuR
GokuL
GokuU
GokuDS
GokuRS
GokuLS
GokuUS

Scripts:
//Put these into the scripts folder if not told elsewhere.

Hero_Script
Code: [Select]
global.current_hero = "Son_Goku";
//change the current_hero variable to whome you want.
//example, global.current_hero = "Son_Gohan";
global.movespeed = 3;
global.dir = "d";
global.can_move=true
global.moving=false
image_speed=0.18
global.hero_talk = false;
global.can_punch = true;
global.Hero_skills = 2;
global.ally_activate = false;
global.scene = 0
global.current_ally = "";
//set the ally variable to whome you want to have as a ally for example.
// globa.current_ally="Vegeta";

//The hero_skills variable is set to 2 so it can only use Ki Blast and
//the kamehameha wave.
// end comment.


check_hero_script
Code: [Select]
//Check hero script
// by Riku Nohara
//Created on September 23rd, 2007 at 12:05PM

//check the hero
if global.current_hero="Son_Goku" then
{
//check the direction
if global.dir="d" then
{
sprite_index = GokuD;
}
}

// Just do this for all your Characters!

//end Script

Object obj_hero

Create Event:
Call hero_script
Call_check_hero_script

Step Event:
Code: [Select]
//Log Movement Script
//By Riku Nohara
if global.can_move=true  {
if global.current_hero="Son_Goku"
{
if (keyboard_check(vk_left))  x -= 2;
if (keyboard_check(vk_right)) x += 2;
if (keyboard_check(vk_up))    y -= 2;
if (keyboard_check(vk_down))  y += 2;
}
if keyboard_check(vk_left) {
global.dir="l"
}
if keyboard_check(vk_right) {
global.dir="r"
}
if keyboard_check(vk_down) {
global.dir="d"
}
if keyboard_check(vk_up) {
global.dir="u"
}
if keyboard_check(vk_left) && global.dir="l" {
if ! keyboard_check(vk_up) && ! keyboard_check(vk_down) {
if ! keyboard_check_released(vk_up) && ! keyboard_check_released(vk_down) {
vspeed=0
}
image_speed=0.18
sprite_index=GokuL
}
}
if keyboard_check(vk_right) && global.dir="r" {
if ! keyboard_check(vk_up) && ! keyboard_check(vk_down)  {
if ! keyboard_check_released(vk_up) && ! keyboard_check_released(vk_down) {
vspeed=0
}
image_speed=0.18
sprite_index=GokuR
}
}
if keyboard_check(vk_down) && global.dir="d" {
if ! keyboard_check(vk_left) && ! keyboard_check(vk_right)  {
if ! keyboard_check_released(vk_left) && ! keyboard_check_released(vk_right) {
hspeed=0
}
image_speed=0.18
sprite_index=GokuD
}
}
if keyboard_check(vk_up) && global.dir="u" {
if ! keyboard_check(vk_left) && ! keyboard_check(vk_right)  {
if ! keyboard_check_released(vk_left) && ! keyboard_check_released(vk_right) {
hspeed=0
}
image_speed=0.18
sprite_index=GokuU
}
}
if keyboard_check(vk_down) && keyboard_check(vk_up) {
if keyboard_check(vk_up) && keyboard_check(vk_down) {
if global.dir="u" {
y -= 2;
}
}
}
if keyboard_check(vk_right) && keyboard_check(vk_left) {
if keyboard_check(vk_left) && keyboard_check(vk_right) {
if global.dir="r" {
x += 2;
}
}
}
}

No key Event:
Code: [Select]
image_speed=0
if global.dir="d" {
sprite_index=GokuDS
}
if global.dir="r" {
sprite_index=GokuRS
}
if global.dir="l" {
sprite_index=GokuLS
}
if global.dir="u" {
sprite_index=GokuLS
}
y -= 0;
y += 0;
x -= 0;
x += 0;



This Script simulates the Legecy of Goku Movement, it may look messy but that is only because I wanted it exactly like the games movement.

Enjoy!
Logged

Goodnight

Once and future Captain
Re: Log Movement Script
« Reply #1 on: September 23, 2007, 10:36:31 pm »
  • With a Capital G
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 706
I would recommend not using the No Key event. The reason is, you can start moving and then hold some other button, release the movement button, and the No Key won't happen. So just move that code to the Step event and surround it with a condition that checks if you aren't pressing any of the four movement buttons.



Otherwise, thanks for sharing.
Logged
Re: Log Movement Script
« Reply #2 on: September 24, 2007, 12:04:33 am »
  • The king of Awesome
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 198
Thanks, I'll do that.

Ok since I want to basically program my own stuff I just need help for when I go diagonal speed in a zelda game(cause I'm making one) this script would work great for the log game.
Logged
Re: Log Movement Script
« Reply #3 on: September 24, 2007, 12:33:09 am »
  • The king of Awesome
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 198
If your making a Zelda game use this instead of the above one.

Code: [Select]
//Zelda Movement Script
//By Riku Nohara
if global.can_move=true  {
if global.current_hero="Son_Goku"
{
if (keyboard_check(vk_left))  x -= global.movespeed;
if (keyboard_check(vk_right)) x += global.movespeed;
if (keyboard_check(vk_up))    y -= global.movespeed;
if (keyboard_check(vk_down))  y += global.movespeed;
}

if keyboard_check(vk_left) {
global.dir="l"
global.movespeed=1.3
}
if keyboard_check(vk_right) {
global.dir="r"
global.movespeed=1.3
}
if keyboard_check(vk_down) {
global.dir="d"
global.movespeed=1.3
}
if keyboard_check(vk_up) {
global.dir="u"
global.movespeed=1.3
}
if (keyboard_check(vk_down) && !keyboard_check(vk_left) && !keyboard_check(vk_right)) { global.movespeed=2 }
    else if (keyboard_check(vk_up) && !keyboard_check(vk_left) && !keyboard_check(vk_right)) {  global.movespeed=2 }
    else if (keyboard_check(vk_left) && !keyboard_check(vk_down) && !keyboard_check(vk_up)) {  global.movespeed=2 }
    else if (keyboard_check(vk_right) && !keyboard_check(vk_down) && !keyboard_check(vk_up)) {  global.movespeed=2 }
if keyboard_check(vk_left) && global.dir="l" {
if ! keyboard_check(vk_up) && ! keyboard_check(vk_down) {
if ! keyboard_check_released(vk_up) && ! keyboard_check_released(vk_down) {
vspeed=0
}
image_speed=0.18
sprite_index=GokuL
}
}
if keyboard_check(vk_right) && global.dir="r" {
if ! keyboard_check(vk_up) && ! keyboard_check(vk_down)  {
if ! keyboard_check_released(vk_up) && ! keyboard_check_released(vk_down) {
vspeed=0
}
image_speed=0.18
sprite_index=GokuR
}
}
if keyboard_check(vk_down) && global.dir="d" {
if ! keyboard_check(vk_left) && ! keyboard_check(vk_right)  {
if ! keyboard_check_released(vk_left) && ! keyboard_check_released(vk_right) {
hspeed=0
}
image_speed=0.18
sprite_index=GokuD
}
}
if keyboard_check(vk_up) && global.dir="u" {
if ! keyboard_check(vk_left) && ! keyboard_check(vk_right)  {
if ! keyboard_check_released(vk_left) && ! keyboard_check_released(vk_right) {
hspeed=0
}
image_speed=0.18
sprite_index=GokuU
}
}
if keyboard_check(vk_down) && keyboard_check(vk_up) {
if keyboard_check(vk_up) && keyboard_check(vk_down) {
if global.dir="u" {
y -= global.movespeed;
}
}
}

Since Link goes slower while he goes diagonally I just made it slower but not by much.
« Last Edit: September 24, 2007, 12:36:35 am by DarkFusion »
Logged

Venyux

Re: Log Movement Script
« Reply #4 on: September 24, 2007, 03:26:07 pm »
Like I said on a other forum, even if your scripts are fairly good, they're messy too...
Anyway, good job on them.
Logged
Re: Log Movement Script
« Reply #5 on: September 25, 2007, 11:43:00 pm »
  • The king of Awesome
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 198
The current version is perfect, the speed and animation is exactly like Minish Cap, everyone has there own programming style.
Logged

Venyux

Re: Log Movement Script
« Reply #6 on: September 26, 2007, 01:19:27 pm »
Yea, don't care, I know that everybody has his own programming / spriting etc... Style. If you like programming like that, It's good for you. It's just that I'm too much perfectionist. ^^'
Logged
Pages: [1]   Go Up

 


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



Page created in 0.424 seconds with 52 queries.

anything