Go to page Previous  1, 2  [ 24 posts ]  Reply to topicPost new topic 
Author Message
 [at]
 Post subject: Re: DJ Coco's GML Scripts
PostPosted: Wed Sep 14, 2016 3:28 am 
Cliax Codec X Splatoon
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
Magnemania wrote:
Wouldn't the raycast be a bit faster if you calculated lengthdir_x and lengthdir_y outside of the for loop and saved it as a constant? It's generally best to use as few sin/cos operations as you can.
Oh, yeah, that's true. There's no reason to recalculate it every iteration. I edited the script now and placed it outside the loop - thanks for the heads-up.

_________________
Image

Cliax Codec is a combination of top-down and third-person shooter. The gameplay will blend platforming, puzzle and shmup elements together to create a unique gameplay experience. You will take control of four playable characters which rise against a team that seemingly wants to take over the world - but are their motives really that cliché, or are there deeper motives behind their actions?

Currently designing Chapter 1-6, 5%

GOTM titles
Spoiler:
Fan Art
Spoiler:
 
Top
Offline 
 User page at mfgg.net
 
 [us]
 Post subject: Re: DJ Coco's GML Scripts
PostPosted: Wed Sep 14, 2016 7:02 am 
User avatar
Lawful Evil
Member
[*]
[*]
[*]
[*]
[*]

[*]
Happy to help!

_________________
Image
Magikoopa Security Force, the Mario Action-Strategy game!
  It's time to fight for Bowser!
 
Top
Offline 
 User page at mfgg.net
 
 [at]
 Post subject: Re: DJ Coco's GML Scripts
PostPosted: Mon Nov 28, 2016 11:38 am 
Cliax Codec X Splatoon
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
string_wrap(str, width)
Formats a string with automatic linebreaks. Download GMZ example

Syntax: [ Download ] [ Hide ]
Using gml Syntax Highlighting
///string_wrap(str, width)
// Argument str: string to format, string
// Argument width: maximum width of the string in pixels, real
// Returns: string formatted with linebreaks
 
var str = argument0, width = argument1, cur_word = "", saved_pos = 1;
 
for (var i = 1; i <= string_length(str); i++) {
    cur_word += string_char_at(str, i);
    if (string_char_at(str, i) == " " || i == string_length(str)) {
        if (string_width(string_copy(str, 1, i)) >= width) {
            str = string_insert("#", str, saved_pos);
            str = string_delete(str, saved_pos + 1, 1);
        }
        saved_pos = i;
        cur_word = "";
    }
    if (string_width(cur_word) >= width) {
        str = string_insert("#", str, i);
        cur_word = "";
    }
}
 
return str;

_________________
Image

Cliax Codec is a combination of top-down and third-person shooter. The gameplay will blend platforming, puzzle and shmup elements together to create a unique gameplay experience. You will take control of four playable characters which rise against a team that seemingly wants to take over the world - but are their motives really that cliché, or are there deeper motives behind their actions?

Currently designing Chapter 1-6, 5%

GOTM titles
Spoiler:
Fan Art
Spoiler:
 
Top
Offline 
 User page at mfgg.net
 
 [at]
 Post subject: Re: DJ Coco's GML Scripts
PostPosted: Tue Jul 11, 2017 6:10 am 
Cliax Codec X Splatoon
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
ping_pong(t, length)
Should be the same as the PingPong method from the Mathf class in Unity.
Reference

Illustration:
Image

Syntax: [ Download ] [ Hide ]
Using gml Syntax Highlighting
///ping_pong(t, length)
// Argument t: The value to ping pong, real
// Argument length: The maximum length t can reach, real
// Returns: The ping ponged value, real

var t = argument0, length = argument1;

var remainder = t % length;
if ((t div length) % 2 == 1) {
    remainder = length - remainder;
}

return remainder;

_________________
Image

Cliax Codec is a combination of top-down and third-person shooter. The gameplay will blend platforming, puzzle and shmup elements together to create a unique gameplay experience. You will take control of four playable characters which rise against a team that seemingly wants to take over the world - but are their motives really that cliché, or are there deeper motives behind their actions?

Currently designing Chapter 1-6, 5%

GOTM titles
Spoiler:
Fan Art
Spoiler:
 
Top
Offline 
 User page at mfgg.net
 
« Previous topic | Next topic »
Display posts from previous:  Sort by  
Go to page Previous  1, 2  [ 24 posts ]  Reply to topicPost new topic 


Who is online

Users browsing this topic: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group