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: How to fix up Morees transitional engine!  (Read 746 times)

0 Members and 1 Guest are viewing this topic.

Koh

How to fix up Morees transitional engine!
« on: November 19, 2006, 03:44:56 pm »
  • Tamer Koh
  • *
  • Reputation: +6/-0
  • Offline Offline
  • Gender: Male
  • Posts: 980
Create your player object (make your player persistent) and put this in the Create Event:
Code: [Select]
lvx=view_xview[0]
lvy=view_yview[0]
global.transition = 0;
global.transDir = ""
global.viewTargX = 0;
global.viewTargY = 0;

Then make an End Step event and make a pice of code containing this (Replace objLink with your player object):
Code: [Select]
//Check if player is outside the view
if (global.transition) exit;
vx = view_xview[0] //Set up some placeholders to save space
vw = view_wview[0]
vy = view_yview[0]
vh = view_hview[0]

if (objLink.x< vx)
{
global.transDir = "left"
global.transition = 1;
global.viewTargX = (vx-vw)
}

else if ((objLink.x+objLink.sprite_width) > vx+vw)
{
global.transDir = "right"
global.transition = 1;
global.viewTargX = (vx+vw)
}

else if (objLink.y< vy)
{
global.transDir = "up"
global.transition = 1;
global.viewTargY = (vy-vh)
}

else if ((objLink.y+objLink.sprite_height) > vy+vh)
{
global.transDir = "down"
global.transition = 1;
global.viewTargY = (vy+vh)
}

then Put another piece of code after that containing this (Replace objLink with your player object):
Code: [Select]
if (!global.transition) exit;
//Check if the view is in the right place and, if not, move it closer
//Move Right
if (global.viewTargX > view_xview[0])
 {
  view_xview[0] += 16;
  objLink.x+=1.8
  lvx=view_xview[0]
  lvy=view_yview[0]
 }
else if global.transDir = "right"
  {view_xview[0] = global.viewTargX; global.transition = 0}
//Move left
if (global.viewTargX < view_xview[0])
 {
  view_xview[0] -= 16;
  objLink.x-=1.8
  lvx=view_xview[0]
  lvy=view_yview[0]
 }
  else if global.transDir = "left"
  {view_xview[0] = global.viewTargX; global.transition = 0}
 //Move down
if (global.viewTargY > view_yview[0])
  {
  view_yview[0] += 16;
  objLink.y+=2
  lvx=view_xview[0]
  lvy=view_yview[0]
  }
  else if global.transDir = "down"
  {view_yview[0] = global.viewTargY; global.transition = 0}
//Move up
if (global.viewTargY < view_yview[0])
 {
  view_yview[0] -= 16;
  objLink.y-=2
  lvx=view_xview[0]
  lvy=view_yview[0]
 }
  else if global.transDir = "up"
  {view_yview[0] = global.viewTargY; global.transition = 0}

Then go in your room and put this in the Creation Code (Replace objLink with your player object):
Code: [Select]
if(instance_exists(objLink)){
view_xview=objLink.lvx
view_yview=objLink.lvy
}

This especially goes to moree so he won't have mind boggling problems on howto fix it up.
« Last Edit: November 19, 2006, 03:46:34 pm by dlbrooks33 »
Logged
  • Megaclipse Games
Pages: [1]   Go Up

 


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



Page created in 0.036 seconds with 36 queries.

anything