public

Rpg Maker Developers Group

Simple enough for a child, powerful enough for a developer

2 Followers

Sprite Moving with Character

BMM Archive · July 15, 2026

Preserved forum archive. This topic stores the original first post and locally mirrored RPG Maker Web attachments when available. It is posted by the BMMPlay archive account, not by the original creator.

Original Source

  • Original title: Sprite Moving with Character
  • Original author: sayus2884
  • Original date: August 22, 2019
  • Source thread: https://forums.rpgmakerweb.com/threads/sprite-moving-with-character.112451/
  • Source forum path: Game Development Engines > RPG Maker Javascript Plugins > Learning Javascript

Summary

Hi. So I'm able to add a sprite into the Scene_Map. However, the sprite moves with the character relative to its x and y on the screen. How do I make it so it just stays in the specified position? Spoiler: Moving with Character { "lightbox_close": "Close",

Archived First Post

Hi. So I'm able to add a sprite into the Scene_Map. However, the sprite moves with the character relative to its x and y on the screen. How do I make it so it just stays in the specified position?

Protected download
Protected download

Here is the code for my sprite

Code:
Sprite_ItemIcons.prototype = Object.create(Sprite.prototype);
  Sprite_ItemIcons.prototype.constructor = Sprite_ItemIcons;

  Sprite_ItemIcons.prototype.initialize = function(item = {}, event){
    Sprite.prototype.initialize.call(this);

    this._item = item;
    this._event = event;

    this.createIcon();
    this.refreshIcon();
  }

  Sprite_ItemIcons.prototype.createIcon = function() {
    this._iconBitmap = ImageManager.loadSystem('IconSet');
    this._icon = new Sprite(this._iconBitmap);

    var x = this._event.screenX() - 16;
    var y = this._event.screenY() - 40;
    this.setTransform(x,y);

    this.addChild(this._icon);
  }

  Sprite_ItemIcons.prototype.refreshIcon = function() {
    var w = Window_Base._iconWidth;
      var h = Window_Base._iconHeight;
      var iconindex = this._item.iconIndex;
      var sx = iconindex % 16 * w;
      var sy = Math.floor(iconindex / 16) * h;
    this._icon.setFrame(sx,sy,w,h);
  }

Then I used this.addChild() from the Scene_Map class to add the sprite into the map.

Downloads / Referenced Files

Log in to download

Log in, then follow the RPG Maker Developers Group to see these download links.

Log in to download

Referenced Images / Attachments

pos1.PNG
pos1.PNG
pos2.PNG
pos2.PNG
Creator Claims / Removal

If you are the original creator and want this listing reassigned, edited, or removed, join BMMPlay and contact the moderators with proof that matches the original RPG Maker Web profile, linked GitHub, itch.io page, or another public creator identity.

#039#rpg-maker-archive#js-learning

Replies (0)

No replies yet.

0 replies 1 view

Log in to reply.

User Avatar