Drawing a colour to a pixel (or multiple pixels)

nathanlink169

Game Dev by Career, no idea what I'm doing
Veteran
Joined
Aug 15, 2013
Messages
59
Reaction score
21
First Language
English
Primarily Uses
RMMV
Hi all.

I'm trying to highlight an area with a semi-transparent colour to represent an NPC's vision cone. Is there a way to say "draw this colour at this location"?
 

Ace of Spades

Veteran
Veteran
Joined
Jan 19, 2017
Messages
93
Reaction score
120
First Language
English
Primarily Uses
Not sure if you're just needing the visual part of the vision cone showing, but if that's the case why not just use the show picture command in editor? You can set the coordinates to variables, set the opacity, and it'll give you more creative control on how it should look (for example if you want a gradient in the vision cone)
 

pasunna

Veteran
Veteran
Joined
Feb 3, 2019
Messages
289
Reaction score
69
First Language
thai
Primarily Uses
RMMV
this plugin process the visual sensor
but… if you want to write your own code
you need to dig in by yourself
because I’m not do it yet…
 

nathanlink169

Game Dev by Career, no idea what I'm doing
Veteran
Joined
Aug 15, 2013
Messages
59
Reaction score
21
First Language
English
Primarily Uses
RMMV
Not sure if you're just needing the visual part of the vision cone showing, but if that's the case why not just use the show picture command in editor? You can set the coordinates to variables, set the opacity, and it'll give you more creative control on how it should look (for example if you want a gradient in the vision cone)
Thank you for the suggestion! I did consider this at first, but I ran into a few theoretical issues. I'm using a pixel-based movement in my game, rather than tile-based, so ensuring that the image is pixel-perfect to the math that's happening will be a slight pain. Another issue is that if the vision gets blocked by the terrain, I want to be able to reflect that. I'm not certain that's possible with an image. Lastly, I think this is a good learning opportunity.

this plugin process the visual sensor
but… if you want to write your own code
you need to dig in by yourself
because I’m not do it yet…
Thanks for the resource! I'll take a look at how they're doing the drawing. I definitely want to write my own code for this, primarily to learn. I've done vision cones in other languages and they're not terribly difficult to do, I'm just unfamiliar with the RPG Maker library exactly.
 

pasunna

Veteran
Veteran
Joined
Feb 3, 2019
Messages
289
Reaction score
69
First Language
thai
Primarily Uses
RMMV
and this is japanese version where the dev still actively improving it

by myself the English plugin is in alien language haha...
he use something beyond my knowledge
I only understand something more base rpg maker mv editing...
and my mathematic skill is poor...haha...
the japanese one use bitmap function that I guess is the one
had no time to experiment on it yet
 

nathanlink169

Game Dev by Career, no idea what I'm doing
Veteran
Joined
Aug 15, 2013
Messages
59
Reaction score
21
First Language
English
Primarily Uses
RMMV
I was able to figure out the answer to my question. MV uses PIXI.js as its graphics manager. The following code will draw a box on screen:

JavaScript:
// Call this code on initialization
this._sprite = new PIXI.Graphics();
SceneManager._scene.addChild(this._sprite);

// Call this code any time you want to change what is displayed
this._sprite.clear();
this._sprite.beginFill(0xFF0000, 0.5);
this._sprite.drawRect(50, 200, 100, 75);
this._sprite.endFill();
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

It's weird I actually have MORE work to do when stuck at home than before.
The No Travel Game Jam is here! Jump in to make a game in the month of April that takes place all in one town!


Decided to take a stab at video editing.... Even made a clickbait screen. I'm so proud of my sellout ways. :LZSexcite:

Forum statistics

Threads
95,470
Messages
929,392
Members
125,711
Latest member
cst
Top