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: (RE)gamemaker movement help  (Read 1407 times)

0 Members and 1 Guest are viewing this topic.

The gold chuchu

Maybe not?...
(RE)gamemaker movement help
« on: September 10, 2006, 11:14:45 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 387
i was up all lastnight trying to do this,so i came here to ask:how do i make link move in the left,right,down,and up stance.and how to use the items he gets....i know,i'm stupit. ;)
Logged
Re: (RE)gamemaker movement help
« Reply #1 on: September 10, 2006, 11:21:10 pm »
  • =/
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 2284
Have a variable that tracks his direction, so lets say he was looking down, put this:

Code: [Select]
if global.direction = 'down'{
  sprite_index = spr_link_walking_down
}
Logged

The gold chuchu

Maybe not?...
Re: (RE)gamemaker movement help
« Reply #2 on: September 10, 2006, 11:33:33 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 387
oohhhh :),i wont the movement from OoT.....is it hard to do? :-\
Logged
Re: (RE)gamemaker movement help
« Reply #3 on: September 10, 2006, 11:37:15 pm »
  • =/
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 2284
Here:
Walking:
Code: [Select]
//If global position is equal to nothing or walking
if global.position = 0 or global.position = 1{
 scr_link_sprite_index(spr_link_walking_right,spr_link_walking_up,spr_link_walking_left,spr_link_walking_down,global.direction); //Set links sprite index

//Optomize the keys for this scripts
 keydown = keyboard_check(global.keydown)
 keyright = keyboard_check(global.keyright)
 keyleft = keyboard_check(global.keyleft)
 keyup = keyboard_check(global.keyup)

//Turn off the key variables
if !keydown and !keyright and !keyleft and !keyup{
 global.position = 0
  image_speed = 0
   image_index = 0
}
else
{
 image_speed = 0.4
}
 
//Cancel out the keys
if keydown and keyright and keyleft and keyup{
 global.position = 0
}

//Walking down
if keydown and !keyright and !keyleft and !keyup{
 global.position = 1
  global.direction = 270
   repeat(3)
    if place_free(x,y+1){
     y += 1
}}

//Walking up
if keyup and !keyright and !keyleft and !keydown{
 global.position = 1
  global.direction = 90
   repeat(3)
    if place_free(x,y-1){
     y -= 1
}}

//Walking left
if keyleft and !keyright and !keydown and !keyup{
 global.position = 1
  global.direction = 180
   repeat(3)
    if place_free(x-1,y){
     x -= 1
}}

//Walking right
if keyright and !keydown and !keyleft and !keyup{
 global.position = 1
  global.direction = 0
   repeat(3)
    if place_free(x+1,y){
     x += 1
}}

//Walking down-left
if keydown and keyleft and !keyright and !keyup{
 global.position = 1
  global.direction = 225
   repeat(2)
    if place_free(x,y+1){
     y += 1
}
 repeat(2)
  if place_free(x-1,y){
   x -= 1
}}

//Walking down-right
if keydown and keyright and !keyleft and !keyup{
 global.position = 1
  global.direction = 315
   repeat(2)
    if place_free(x,y+1){
     y += 1
}
 repeat(2)
  if place_free(x+1,y){
   x += 1
}}

//Walking up-left
if keyup and keyleft and !keyright and !keydown{
 global.position = 1
  global.direction = 135
   repeat(2)
    if place_free(x,y-1){
     y -= 1
}
 repeat(2)
  if place_free(x-1,y){
   x -= 1
}}

//Walking up-right
if keyup and keyright and !keyleft and !keydown{
 global.position = 1
  global.direction = 45
   repeat(2)
    if place_free(x,y-1){
     y -= 1
}
 repeat(2)
  if place_free(x+1,y){
   x += 1
}}}

Sprite index:
Code: [Select]
//Sets links sprite index to whatever the arguments tell it
//Technicly, this could work for anything
//That use directions to find the sprite index
//Arguments:
//Arg 0: Walking right sprite index
//Arg 1: Walking up sprite index
//Arg 2: Walking left sprite index
//Arg 3: Walking down sprite index
//Arg 4: The variable that has to equal a certain number to have that sprite index

if argument4 = 0{
 sprite_index = argument0
}

if argument4 = 90{
 sprite_index = argument1
}

if argument4 = 180{
 sprite_index = argument2
}

if argument4 = 270{
 sprite_index = argument3
}

Also:
Create event:
Code: [Select]
global.position = 0
global.direction = 0
global.resource_pack = 1
global.keydown = vk_down
global.keyright = vk_right
global.keyleft = vk_left
global.keyup = vk_up

Don't ask how efficiant it is since I ripped it streight from my old game.
« Last Edit: September 10, 2006, 11:39:09 pm by piers »
Logged

The gold chuchu

Maybe not?...
Re: (RE)gamemaker movement help
« Reply #4 on: September 10, 2006, 11:42:16 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 387
cool,did it take long to do that?
Logged
Re: (RE)gamemaker movement help
« Reply #5 on: September 10, 2006, 11:43:52 pm »
  • =/
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 2284
cool,did it take long to do that?
I think 10 minutes. It's really un-optomized but I since deleted alot of my old examples.
Logged

The gold chuchu

Maybe not?...
Re: (RE)gamemaker movement help
« Reply #6 on: September 12, 2006, 01:51:54 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 387
every time i try to play my game,it says error,unknown futsoin or script:sprite_index? :-[...what did i do wrong? >:(
Logged
Re: (RE)gamemaker movement help
« Reply #7 on: September 12, 2006, 02:07:44 am »
  • =/
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 2284
Here:
http://www.64digits.com/download.php?name=TLOZ.zip&id=8784
 It was supposed to be a remake that never totally got into action. It only has a map loader (Credit if used), walking and sprite index scripts. It should teach you a bit.
Logged
Pages: [1]   Go Up

 


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



Page created in 0.065 seconds with 50 queries.

anything