Classic Forums

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back. Discord - https://discord.gg/U7C8YNYF63

Pages: 1 ... 6 7 [8] 9 10
 71 
 on: August 13, 2017, 08:10:57 PM 
Started by maximus_asinus - Last post by maximus_asinus
Also thanks for replying. I have no scripting experience outside GS1, and it is very frustrating coming against hurdles when there is nobody else willing to help out. It isn't likely I will solve this on my own.

 72 
 on: August 13, 2017, 07:36:06 PM 
Started by maximus_asinus - Last post by maximus_asinus
I should have been clear that what I posted was the formula I based the water movement on. This is my original script.

Code: [Select]
//#CLIENTSIDE
function onCreated() {
this.setimg("block.png");
}
function onActionPulled() {
    if (this.waterlevel == 0) {
  this.final = {9,39,47,39,47,27,55,27,55,47,9,47}; // x, y values of where the water starts filling
    this.current = {11,41,49,41,49,29,53,29,53,45,11,45}; // x, y values where the water is finished filling
    }
    else if (this.waterlevel == 1) {
  this.final = {11,41,49,41,49,29,53,29,53,45,11,45};
    this.current ={9,39,47,39,47,27,55,27,55,47,9,47}; 

    }
    this.time = 0;
    this.waterlevel = !this.waterlevel;
    setTimer(0.05);
}
function onTimeout() {
    for (this.a=0;this.a<=this.final.size();this.a++;) {
      this.distx = this.final[0+this.a] - this.current[0+this.a]; // finds the difference between the coordinates in both arrays
      this.disty = this.final[1+this.a] - this.current[1+this.a];
      this.movelength = (this.distx * this.distx + this.disty * this.disty) ^ 0.5; // finds out how many tiles away
      this.distx = this.distx / this.movelength;
      this.disty = this.disty / this.movelength;
      this.current[0+this.a] = this.current[0+this.a] + this.distx * 0.05; // move a step towards the final target
      this.current[1+this.a] = this.current[1+this.a] + this.disty * 0.05;
      showpoly(200,this.current);
      changeimgcolors 200,0,0,1,0.75;
      this.a++;
    }
    setTimer(0.05);
  }
}

 73 
 on: August 13, 2017, 04:57:54 AM 
Started by maximus_asinus - Last post by Thor
I'm not sure what it is you're trying to accomplish here, as surely the water should rise irrespective of the player's position, unless this is inside a gani script?

What I do is store a tile width and height of the fill area, as well as a filled width and height, and calculate the showpoly x/y/position like so:

Code: [Select]
function updatePoly() {
  temp.x = this.x + this.getWaterX();
  temp.y = this.y + this.getWaterY();
  this.showpoly(200, {temp.x, temp.y, temp.x + this.filledWidth, temp.y, temp.x + this.filledWidth, temp.y + this.filledHeight, temp.x, temp.y + this.filledHeight});
}

function getWaterX()
  return (this.waterWidth - this.filledWidth) / 2;


function getWaterY()
  return (this.waterHeight - this.filledHeight) / 2;

 74 
 on: August 10, 2017, 02:59:48 PM 
Started by maximus_asinus - Last post by maximus_asinus
Maybe you can help me. I am not sure how you moved the showpoly, but I am using the following (tweaked a bit, this is an example).

Code: [Select]
  toPlayerX = playerx - x;
  toPlayerY = playery - y;
  toPlayerLength = (toPlayerX * toPlayerX + toPlayerY * toPlayerY) ^ 0.5;
  toPlayerX = toPlayerX / toPlayerLength;
  toPlayerY = toPlayerY / toPlayerLength;
  x = x + toPlayerX * this.speed;
  y = y + toPlayerY * this.speed;

This has the showpoly moving in a very fluid manner. The problem is it never reaches the exact target coordinates (always off by a few hundredths of a decimal point). This causes some very weird visual glitches where the showpoly will 'bounce' between two coordinates. If I could control the increments (to 0.05 for example) that it moved that would solve my problem, but I don't really understand the math enough to do this. Can you help me out?

 75 
 on: August 09, 2017, 01:21:48 PM 
Started by maximus_asinus - Last post by Thor
A combination of showpoly and setshape2.

 76 
 on: August 08, 2017, 10:33:08 AM 
Started by maximus_asinus - Last post by maximus_asinus
I'm trying to replicate the rising water from Link to the Past. How did you accomplish this Thor? Was it a combination of showpoly and changing the zoom (is that even possible?). Or did you create an image and stretch it?

 77 
 on: August 04, 2017, 05:02:10 PM 
Started by maximus_asinus - Last post by maximus_asinus
Late reply but someone sent me the editor, plus I got access to a Dev server to practice GS2.

 78 
 on: July 29, 2017, 04:24:00 AM 
Started by maximus_asinus - Last post by Racil
You saying 2.2 isn't working or you can't download it? I could upload it to my dropbox when I get home.

 79 
 on: July 27, 2017, 05:06:47 PM 
Started by maximus_asinus - Last post by maximus_asinus
Normal level editor is downloadable from the login server.
Doesn't work, and I've tried using FP4's patch posted on Graalians.

 80 
 on: July 27, 2017, 11:39:41 AM 
Started by maximus_asinus - Last post by Thor
Normal level editor is downloadable from the login server.

Pages: 1 ... 6 7 [8] 9 10