Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Scripting ideas

Zeriab

Sponsor

Scripting ideas

Ever had that idea which you were too lazy or too busy to do? Maybe you worked on it and then for some reason gave it up?
The idea behind this thread is partly to capture both ideas and possible knowledge and work by scripters before they leave this community, partly to inspire scripters and give them ideas.
If you have worked on the ideas and then abandoned it feel free to provide the work you have already done and/or thoughts you have had about it.

List of ideas:

You do not have to be a scripter to post ideas you have, but...
This is NOT a request thread
I think this is obvious, but let me spell it out anyways by an example.
Say you have this super cool idea for this awesome CMS and you for some reason think that posting it here will get a scripter to create it for you.
While that is a possibility it's much more likely that the scripter creates it for his or her own game. By posting the idea in this thread you have given the scripter permission to use it, but you are in no position to require.
Of course it's also possible that it won't be touched.

Terms and Conditions
By posting in this topic you agree that any ideas and any material* you present in this topic becomes public domain. (If it's not possible in your jurisdiction then you give everyone reading this topic the right to use, modify, and publish your resources and ideas as if it was public domain)
Material is here considered to the raw text and the actual images referenced by -tags.
Not having read the terms and conditions does not make exempt you from them.

Note that if you give links then only the links under the terms and not what they link to. It's only the data in this topic and images where use [img] tags.
Note also that the terms are naturally void if you do not have permission to grant the necessary rights.

On a final note you give me permission to alter and use your post in my own posts. It's already covered elsewhere, but I'll just say it again so you know it. I may alter and move around the posts to make this thread more inviting :3
I intend to keep this topic clean.[/spoiler]

*hugs*
- Zeriab
 

Zeriab

Sponsor

Here is an idea I just had. It's about detecting if a point, say mouse point is inside a number of polygons.
You could for example use this if you had a mouse script and a world map and then highlight the relevant sections.
I have some thoughts on it such as what is the action if polygons overlap. Can we ensure that polygons do not overlap? Perhaps a configuration utility which checks for any overlaps among any number of polygons.
Will creating the smallest possible box around the polygons help in speed up the detection algorithm? (Maybe you can more quickly discard a number of polygons as being uninteresting)

*hugs*
 

Zeriab

Sponsor

Here's another scripting idea I have which basically is a project I have abandoned. I dunno really why I have abandoned it. I'll just leave it up to any other scripts to take it up and complete it. Eventers will love you if you complete it :3
What I am talking about is my Switch and Variable swapper which can be useful for eventers since they don't have to take as much care about choosing ids which hopefully won't be in use in other projects.

Here is the my project which anyone is free to use, modify and copy in any way they want: http://www.mediafire.com/download.php?ykqz45ztwz4
Commercial and non-commercial use alike is allowed. (Dunno why it would be commercial, but I allow it none-the-less)

The code is ugly and I think the prospect of a rewrite was what made me drop it now when I think about it.
 
That'd be awesome if someone created a proper projectile library, completely independent of any script, so it could be used for any kind of game, from a shoot'em up to an abs, or whatever.
You'd be able to set up the type of trajectories, and graphics they use, etc... maybe using the database animations, and display it for the graphics and simply having to move them.
 

Sir

Member

Dancing script, you know how like you got dance offs and shit. Like alright so you wanna make a dance battle game in rmxp (so cool i hope someone does it!) :P make a dance script, using the arrows you dance your character around and like using different buttons you can make your character dance with different moves like use their hands and shit which will like acumulate points and ya know. Just had that idea jus now lol

EDIT: yep, that's just given me a killer idea for a game, i am so doing this! won't be able to script it, but ey!
 

Illitum

Sponsor

With the world map polygon idea, maybe it only allows you to mouse-over the Large 'AREANAME!' text in each section, as words are unlikely to overlap, it wouldn't need to have in place an overlap.

If in the case large areas would have smaller areas within, maybe a sub-map for areas show up :)

I think in the case where parts of the map are selectable, maybe the map should be a base image, where each of the areas is a separate image which 'lights up' as the mouse is over the place name?

Possibly, icons could be shown on this supposed map showing places of interest, these could be shown or not shown depending on script-based switches / variables.
 
First of all, nice thread... even though I got a bunch of unrealized ideas, I don't plan on sharing too much of them... not only because of the huge legal section at the top of this thread that enables Zery to sell all our ideas... >:)

Either way, regarding your cursor highlighting script: the problem with seperate images for highlighted areas would be that they'd have to be placed correctly. That'd involve scripting, and I think standalone scripts are more welcome here as scripting tools ;)
So, an admittedly space-eating, but effective method would be using an image for the area definition: same color means same area. That'd make area detection hell-a-easy (get_pixel), as well as easily enable unconnected areas being considered a single area (think islands that belong to the mainland, but aren't directly connected).
Thinking this further (involving scripting again, though), this would be made extremely versatile by adding a vector engine, similar to vector graphic programs: almost no storage space needed, and scaleable. Because I mainly see the use of an area-definition tool in map appliances such as monster area definition or hazardous gas stuff, instead of eye-candy-ish map usage ^^
(and yes, I am aware this is kind of different from the original idea :p )
 
"Enter description on Save Game"
Allows you to type or select (using the name selection window) a description when you save. The description then displays on saved games.

It's on my list of "shit to do", it's just near the bottom of the list. But I think people would use it if it existed.

Be Well
 

Jason

Awesome Bro

Brewmeister":14mofnw9 said:
"Enter description on Save Game"
Allows you to type or select (using the name selection window) a description when you save. The description then displays on saved games.

It's on my list of "shit to do", it's just near the bottom of the list. But I think people would use it if it existed.

Be Well

Actually that's a really good idea, I've been trying to do something like that for a while, I just don't know how to do it (With name inputting)
 
More like a custom script, since the default Scene_Name is heavily stupid, considering you can't use the keyboard. Also, while we're at player friendlyness, remember to make that save description thing an OPTION, not a necessity - asking people to input a description every time they save would be even more annoying than that stupid "Do you really want to save?" question. Well, that basically forces the scripter to set a pre-defined text string as description (aka "Chapter 1 // The Lover's Shack", aka chapter marker and location hint) the player can build upon.
I imagine that to be quite useful really... and rather easy to pull off as well...
 

Jason

Awesome Bro

Hmm I wonder if...

With an implemented autosave system, whenever it's called in the editor, a line of code could be called like (Yes, this will be bad);

autosave(slot, message)

So for example, this could be done in an event;

Teleport to forest
Call script; autosave(1, "Dark Forest - Area 1")

So once the player is teleported to the forest, it autosaves in slot 1 and names it as above.

I mean, I've tried doing autosaves with events but it just doesn't work, it's easy to force the savescreen on someone whenever you like, but they should be given the freedom to turn autosaving on and off...

Maybe it's something worth considering.
 

Zeriab

Sponsor

Thanks for giving so many good ideas <3

@Blue:
I didn't mean that you should post your unrealized ideas, but rather your abandoned ideas.
It's true that I and everyone else may be able to profit from these ideas. The disclaimer is to illustrate that any ideas here are free to use for everyone. Scripters can use them without worry.

*hugs*
- Zeriab
 

dricc

Member

There is something that a lot of people is waiting for : A battle system with collectible cards .
Like magic the gathering , yu-gi-oh , pokemon , wakfu , bakugan or others ...
But i know that this is very difficult . i think i will try ... one day .

Some scripts i made but never used :

A script to sort a party ! many posibilities (by ATK , level , name ...) . useful for big parties .
Code:
#==============================================================================

# ** Game_Party

#------------------------------------------------------------------------------

#  This class handles the party. It includes information on amount of gold 

# and items. The instance of this class is referenced by $game_party.

#==============================================================================

 

class Game_Party < Game_Unit

 

  #actor_id => valeur

  # la valeur peux représenter ce que vous voulez !!!

    Actor_Value = { 

      1 => -4, 

      2 => 3, 

      4 => -6, 

      5 => 3, 

      6 => -8, 

      7 => 5

      }

      

      # la valeur par défaut pour les acteurs qui ne sont pas dans la liste

      Actor_default_value = 0

 

  def avalue(actor_id)

 #   Valuetab = Actor_Value[@actor_id]

    return Actor_default_value if Actor_Value[@actor_id] == nil

    return Actor_Value[@actor_id]

  end

  

  #--------------------------------------------------------------------------

  # * Sort actors by the table value

  #--------------------------------------------------------------------------

  def sort_value

    result = []

    for i in [email=0..@actors.size]0..@actors.size[/email] - 1

      mini = nil

      for j in [email=0..@actors.size]0..@actors.size[/email] - 1

         mini = j if mini == nil and not result.include?(@actors[j])

         if mini != nil then

           if avalue(@actors[mini]) <= avalue(@actors[j]) and not result.include?(@actors[j]) then

            mini = j

          end

        end

      end

       result.push(@actors[mini])

     end

     @actors = result

      $game_player.refresh

  end

 

    #--------------------------------------------------------------------------

  # * Sort actors by the table value

  #--------------------------------------------------------------------------

  def sort_value_asc

    result = []

    for i in [email=0..@actors.size]0..@actors.size[/email] - 1

      mini = nil

      for j in [email=0..@actors.size]0..@actors.size[/email] - 1

         mini = j if mini == nil and not result.include?(@actors[j])

         if mini != nil then

           if avalue(@actors[mini]) >= avalue(@actors[j]) and not result.include?(@actors[j]) then

            mini = j

          end

        end

      end

       result.push(@actors[mini])

     end

     @actors = result

      $game_player.refresh

  end

 

    

#--------------------------------------------------------------------------

  # * Sort actors by alpha

  #--------------------------------------------------------------------------

  def sort_alpha

    result = []

    for i in [email=0..@actors.size]0..@actors.size[/email] - 1

      mini = nil

      for j in [email=0..@actors.size]0..@actors.size[/email] - 1

         mini = j if mini == nil and not result.include?(@actors[j])

         if mini != nil then

           if $game_actors[@actors[mini]].name <= $game_actors[@actors[j]].name and not result.include?(@actors[j]) then

            mini = j

          end

        end

      end

       result.push(@actors[mini])

     end

     @actors = result

      $game_player.refresh

  end

#--------------------------------------------------------------------------

  # * Sort actors by level

  #--------------------------------------------------------------------------

  def sort_level

    result = []

    for i in [email=0..@actors.size]0..@actors.size[/email] - 1

      mini = nil

      for j in [email=0..@actors.size]0..@actors.size[/email] - 1

         mini = j if mini == nil and not result.include?(@actors[j])

         if mini != nil then

           if $game_actors[@actors[mini]].level <= $game_actors[@actors[j]].level and not result.include?(@actors[j]) then

            mini = j

          end

        end

      end

       result.push(@actors[mini])

     end

     @actors = result

      $game_player.refresh

  end

#--------------------------------------------------------------------------

  # * Sort actors by ATK

  #--------------------------------------------------------------------------

  def sort_atk

    result = []

    for i in [email=0..@actors.size]0..@actors.size[/email] - 1

      mini = nil

      for j in [email=0..@actors.size]0..@actors.size[/email] - 1

         mini = j if mini == nil and not result.include?(@actors[j])

         if mini != nil then

           if $game_actors[@actors[mini]].atk <= $game_actors[@actors[j]].atk and not result.include?(@actors[j]) then

            mini = j

          end

        end

      end

       result.push(@actors[mini])

     end

     @actors = result

      $game_player.refresh

  end

#--------------------------------------------------------------------------

  # * Sort actors by hp

  #--------------------------------------------------------------------------

  def sort_hp

    result = []

    for i in [email=0..@actors.size]0..@actors.size[/email] - 1

      mini = nil

      for j in [email=0..@actors.size]0..@actors.size[/email] - 1

         mini = j if mini == nil and not result.include?(@actors[j])

         if mini != nil then

           if $game_actors[@actors[mini]].hp <= $game_actors[@actors[j]].hp and not result.include?(@actors[j]) then

            mini = j

          end

        end

      end

       result.push(@actors[mini])

     end

     @actors = result

      $game_player.refresh

  end

#--------------------------------------------------------------------------

  # * Sort actors by mp

  #--------------------------------------------------------------------------

  def sort_mp

    result = []

    for i in [email=0..@actors.size]0..@actors.size[/email] - 1

      mini = nil

      for j in [email=0..@actors.size]0..@actors.size[/email] - 1

         mini = j if mini == nil and not result.include?(@actors[j])

         if mini != nil then

           if $game_actors[@actors[mini]].mp <= $game_actors[@actors[j]].mp and not result.include?(@actors[j]) then

            mini = j

          end

        end

      end

       result.push(@actors[mini])

     end

     @actors = result

      $game_player.refresh

  end

 

  #--------------------------------------------------------------------------

  # * Sort actors by spi

  #--------------------------------------------------------------------------

  def sort_spi

    result = []

    for i in [email=0..@actors.size]0..@actors.size[/email] - 1

      mini = nil

      for j in [email=0..@actors.size]0..@actors.size[/email] - 1

         mini = j if mini == nil and not result.include?(@actors[j])

         if mini != nil then

           if $game_actors[@actors[mini]].spi <= $game_actors[@actors[j]].spi and not result.include?(@actors[j]) then

            mini = j

          end

        end

      end

       result.push(@actors[mini])

     end

     @actors = result

      $game_player.refresh

  end

  #--------------------------------------------------------------------------

  # * Sort actors by spi

  #--------------------------------------------------------------------------

 def swap(actor1,actor2)

    result = []

    for i in [email=0..@actors.size]0..@actors.size[/email] - 1

      result.push(@actors[actor2]) if i == actor1

      result.push(@actors[actor1]) if i == actor2

      result.push(@actors[i]) if i != actor2 and i != actor1

     end

     @actors = result

      $game_player.refresh

  end

  

  end

By default , the actor displayed on the map is the first one of your party .
If you want to change that :
Code:
#==============================================================================

# ** Game_Player

#------------------------------------------------------------------------------

#  after a sort of the party , we want the main actor displayed on map remains the same one

#  variable MAIN_ACTOR is the id of this actor

#==============================================================================

 

class Game_Player < Game_Character

 

    MAIN_ACTOR = 1

  

  #--------------------------------------------------------------------------

  # * Refresh

  #--------------------------------------------------------------------------

  def refresh

    if $game_party.members.size == 0

      @character_name = ""

      @character_index = 0

    else

      actor = $game_actors[MAIN_ACTOR]   # Get front actor

      @character_name = actor.character_name

      @character_index = actor.character_index

    end

  end

end
 
The collectible cards thing isn't all that hard at the bases... regular card algorythms (shuffling, drawing, discarding), as well as zones would be rather easy. The a bit more difficult part is the actual action processing... that'd be incredibly depending on the created game and therefore not very suitable for a pre-made script, since whoever uses it would have to be able to script on a more-than-average level theirselves.

Well, there also is that program called Magic Workstation, which allows incredible card management features, yet no rules whatsoever, which is a downside as far as MTG goes, but on the other hand, you can play YuGiOh, Pokemon or whatever card game with that since you decide all rules on the go (depends on the attention of both players at all times, but it's pretty cool in terms of playing against people you can't always meet offline, or just don't have cards at all).
Just saying since it's not only an awesome program, but also illustrates quite nice how turns are handled in MTG, for those who won't read the manual ;)



To contribute something myself: A buddy of mine thought the FFV job system would be cool to have remade. My personal idea long before that was more of a skill system with equipable skills that have to match with other skills in order to be able to be equipped (i.e. 'Swordsmanship' won't work with 'Aerial Attacks'). Obviously, levelling up these skills would be a nice touch to it.
 
I think an adventure game script would be awesome. Not point and click style really, just more of an item interaction system.

I coded one myself but it was my first script so the code probably sucks and it was a bit of a pain in the arse to use. I pretty much forgotten what I knew of Ruby so I won't be adding to it. I never made it like an actual adventure game because adding mouse support would of been hard and I like it how it is.
advent.jpg

It could definitely do with being rewritten and made slightly more user friendly on the editing side of things.

If anyway wants to use it how it is or for any other reason, here it is:
Code:
 

#==============================================================================

# ** Advent

#------------------------------------------------------------------------------

# mtgmaster

# 0.01

# 28/01/2008

#==============================================================================

 

#==============================================================================

# ** Window_Advent

#------------------------------------------------------------------------------

#  Create the HUD

#==============================================================================

class Window_Advent < Window_Selectable

  #--------------------------------------------------------------------------

  # * Object Initialization

  #--------------------------------------------------------------------------

  def initialize

    super(-32, 420, 690, 107)

    self.contents = Bitmap.new(690, 107)

    self.opacity = 0

    refresh

  end

  #--------------------------------------------------------------------------

 

  #--------------------------------------------------------------------------

  # * Refresh

  #--------------------------------------------------------------------------

  def refresh

    self.contents.clear

    ###self.contents.fill_rect(0, 0, 999, 999, Color.new(0,0,0,200))

    bitmap = RPG::Cache.picture("hudbg.png")

    self.contents.blt(16, 0, bitmap, Rect.new(0, 0, 999, 999), 170)

    

    # Draw the icons

    xn = 42

    itemid = 1

    textx = 35

    self.contents.font.size = 10

    for i in 1...$data_items.size

      if $game_party.item_number(i) > 0

        opacity = 100

        item = $data_items[i]

        # If item in hud is the same as being selected to hold

        if $scene.hold == itemid

          opacity = 255

          $holding = item.id

        end

        bitmap = RPG::Cache.icon(item.icon_name)

        self.contents.font.color = Color.new(255,255,255, opacity)

        self.contents.blt(xn, 10, bitmap, Rect.new(0, 0, 24, 24), opacity)

        self.contents.draw_text(textx, 6, 10, 10, itemid.to_s)

        xn += 48

        itemid += 1

      textx += 48

      end

    end

 

  end

  #--------------------------------------------------------------------------

 

  #--------------------------------------------------------------------------

  # * Update

  #--------------------------------------------------------------------------

  def update

    super

    refresh

  end

  #--------------------------------------------------------------------------

end  

 

#==============================================================================

# ** Scene_Map

#------------------------------------------------------------------------------

#  Add the HUD and check for input

#==============================================================================

class Scene_Map

  alias_method :scene_map_main, :main

  alias_method :scene_map_update, :update

  attr_accessor :hold

  attr_accessor :adv_window

  #--------------------------------------------------------------------------

  # * Main

  #--------------------------------------------------------------------------

  def main

    @adv_window = Window_Advent.new

    @adv_window.visible = true

    @adv_window.z = 9999

    scene_map_main

  end

  #--------------------------------------------------------------------------

 

  #--------------------------------------------------------------------------

  # * Update

  #--------------------------------------------------------------------------

  def update

    @adv_window.update

    # Item selection

    if Kboard.keyboard($R_Key_1)

      hold_item(1)

    elsif Kboard.keyboard($R_Key_2)

      hold_item(2)

    elsif Kboard.keyboard($R_Key_3)

      hold_item(3)

    elsif Kboard.keyboard($R_Key_4)

      hold_item(4)

    elsif Kboard.keyboard($R_Key_5)

      hold_item(5)

    elsif Kboard.keyboard($R_Key_6)

      hold_item(6)

    elsif Kboard.keyboard($R_Key_7)

      hold_item(7)

    elsif Kboard.keyboard($R_Key_8)

      hold_item(8)

    elsif Kboard.keyboard($R_Key_9)

      hold_item(9)

    end

    # Hide HUD

    if Kboard.keyboard($R_Key_0)

      @adv_window.visible ? @adv_window.visible = false : @adv_window.visible = true

    end

    # View item (V)

    if Kboard.keyboard($R_Key_L)

      view_item($holding)

    end

    # Menu Hotkeys

    if Kboard.keyboard($R_Key_O)

      $scene = Scene_Journal.new

    end

    scene_map_update

  end

  #--------------------------------------------------------------------------  

 

  #--------------------------------------------------------------------------

  # * view_item

  #-------------------------------------------------------------------------- 

  def view_item(itemid)

    if $holding == nil

      $game_system.se_play($data_system.cancel_se)

      return false

    end

      $game_system.ums_mode = FIT_WINDOW_TO_TEXT

      $game_system.comic_enabled = true

      $game_temp.message_text = '\e[0]' + $data_items[itemid].description.to_s

  end

  #--------------------------------------------------------------------------  

 

  #--------------------------------------------------------------------------

  # * hold_item

  #--------------------------------------------------------------------------  

  def hold_item(item_id)

    unless $game_system.map_interpreter.running? or @move_route_forcing or $game_temp.message_window_showing

      if @hold == item_id

        @hold = 0

        $holding = nil

      else

        @hold = item_id

      end

    end

  end

  #--------------------------------------------------------------------------  

end

 

#==============================================================================

# ** Game_Player

#------------------------------------------------------------------------------

#  Adds the ability to change event interaction when holding an item

#==============================================================================

class Game_Player < Game_Character

  #--------------------------------------------------------------------------

  # * Front Event Starting Determinant

  #--------------------------------------------------------------------------

  def check_event_trigger_there(triggers)

    result = false

    # If event is running

    if $game_system.map_interpreter.running?

      return result

    end

    # Calculate front event coordinates

    new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)

    new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)

    # All event loops

    for event in $game_map.events.values

      # If event coordinates and triggers are consistent

      if event.x == new_x and event.y == new_y and

         triggers.include?(event.trigger)

        # If starting determinant is front event (other than jumping)

        if not event.jumping? and not event.over_trigger?

          #--------------------------------------------------

          # If you're holding an item

          if $holding

            comment = SDK.event_comment_input(event, 1, "Holding").to_s.split('|')

            item_id = comment[0].to_i

            command = comment[1].to_s.split(':')

              switch_id = command[1].to_i

              command_ = command[0].to_s

            # If the item you're holding and the item_id of the event comment match

            if $holding == item_id

              case command_

                # Switch

                when "s"

                  $game_switches[switch_id] = true

                # Self Switch

                when "ss"

                  switch_id = switch_id.to_s.split('.')

                  p switch_id[0]

                  #key = [$game_map.map_id, event.id, switch_id[0].to_s]

                  #$game_self_switches[key] = (switch_id[1].to_i == 0)

                # Common event

                when "c"

                  $game_temp.common_event_id = switch_id

              end

              $game_map.need_refresh = true

            else

              $game_system.se_play($data_system.cancel_se)

              return false

            end

          else

            event.start

          end

          #--------------------------------------------------

         result = true

        end

      end

    end

    # If fitting event is not found

    if result == false

      # If front tile is a counter

      if $game_map.counter?(new_x, new_y)

        # Calculate 1 tile inside coordinates

        new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)

        new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)

        # All event loops

        for event in $game_map.events.values

          # If event coordinates and triggers are consistent

          if event.x == new_x and event.y == new_y and

             triggers.include?(event.trigger)

            # If starting determinant is front event (other than jumping)

            if not event.jumping? and not event.over_trigger?

              event.start

              result = true

            end

          end

        end

      end

    end

    return result

  end

  #--------------------------------------------------------------------------  

end

 

class Game_Character

  attr_accessor :move_speed

end
It uses actual items, any items you have will show up in the GUI and can be used. To use it add these comments to the event.
Comment: Holding
Comment: 1|s:1
The last comment controls item and switching. It's used like this:
[ID of the item you need to be holding] | [s for switch, ss for self switch, c common event] : [ id of the switch/common event to be triggered]
Probably too complicated, could do with simplifying.
Just press the corresponding number on your keyboard to select(hold) or deselect an item. When you have the item selected and press space with the event, the switch or common event is triggered.
Press 0 to hide the GUI.
L makes your character look at the item and shows its description set in the DB.
 
Might I selflessly point anyone trying to improve that adventure script to my Database Flag Reader (link in my signature), which would highly simplify and enhance any interaction processing.

Also, I really like the number key-controlled item selection... pretty good idea as a mouse replacement, even though it doesn't support more than 10 items, I assume... maybe 9. The actual window seems like it should be more apparent, but that might destroy the atmosphere in darker areas/games like the one on the screenshot... hm, maybe it could be improved a tad.
As far as coding goes, it's not a perfectly clean style ( '###' ? :crazy: ), but it's well-commented. You're right as in you could simplify it though...

All in all, nice concept that's well worth to be followed by someone!
 
I like how I'm probably necrodoubleposting now, but guess what - given the topic's purpose, I don't give a fuck!

Updating the idea of a vector-based handling class, allowing multiple other classes to benefit from it, for example Bitmap drawing or general position checking.

Several fancy methods, inconclusive list:

Vector object
.new(vertices) # defines a vector from an array of two- or three-dimensional vertices (i.e. [[13, 2], [12, 67]], measured in pixels, not tiles!)
.unset! # drops a vector
.add_vertex(index, point) # adds a vertex at position index within the array, at the given coordinates from a two- or three-dimensional array
.remove_vertex(index) # drops the vertex and position index
.twodimensional # converts all vertices into two-dimensional arrays by dropping the last element within every array of every vertex
.twodimensional!
.threedimensional # converts all vertices into three-dimensional arrays by addion 0 as the last element to every array of every vertex
.threedimensional!
.rotate(point of origin, degrees) # turns the vector around point of origin (two-dimensional array) by degree degrees
.rotate!(point of origin, degrees)
.flip(point of origin, direction) # flips the vector over an axis given by the point of origin and a direction, measured in degrees
.flip!(point of origin, direction)
.create(aSprite) # creates a vector outlining a given sprite, ignoring transparent pixels obviously
.merge(aVector) # merges two vectors, dropping overlapping vertices, returns false if vectors don't overlap
.substract(aVector) # subtracts a given vector from the current one, returns false if vectors don't overlap
.enclose?(point/aVector) # checks if given two- or three-dimensional point, or vector is within the vector

...and certainly way cooler stuff than that, but I figure you'd want the basics covered first, eh?


While the thread rules don't imply it, I'd still ask whoever might attempt this to publicise it, since this could really spawn some really interesting systems on their own. And well, even if you won't, at least notify people about the process ;)
I'd like to do it myself, but despite being an awful scripter :down: I just don't know any math... or Math, for that matter ;)
 
well about the vector class, you could simply re use the one provided by ruby, given in a rb file. it also has a matrix class. just look in the lib/ruby folders.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top