I'm seeking a pixel collision script that masks the sprites, including Actors. Players to be precise.
I'm using Victor Saint's Pixel Movement for compatibility.
Here's a masked example. Before, after:
This is how I requested this script. The masked sprite contains collision. Event characters are not the only sprites that have collisions. A collision folder should be necessary for masked sprites. You could implement a masked folder instead if you like.
EDIT 1: I could use the collision mechanic like Rosedale Collision Altering. But, I'm using the VX Ace version. I now include tilesets to mask for collision. I don't want to use a 'B' word to keep this thread alive. It's not a bad word I censor, it's about **** into someone. I gave you a hint on this. It's just I don't want to break a rule, not knowing where the rules post is.
EDIT 2:
A custom collision mask in RPG Maker VX Ace can be achieved through scripting by altering the standard collision mask of sprites or events. This involves modifying the Ruby scripts within the RPG Maker engine to define the collision area based on the actual sprite image instead of a simple rectangle.
Here's a breakdown of how to create a custom collision mask:
1. Understanding the Default Collision System
RPG Maker VX Ace uses a tile-based collision system, where characters and events are considered to occupy a grid of 32x32 tiles.
By default, the collision area of a sprite or event is a rectangle based on its image dimensions.
2. Creating a Custom Collision Mask
Option 1: Using the sprite as the collision mask (Precise Collision)
Enable Precise Collision: Set the sprite's collision mode to "precise" in the sprite editor.
Define the Collision Area: The engine will then use the actual pixels of the sprite to determine collisions, allowing for more complex shapes.
Option 2: Custom Scripts for Collision Checks
Modify Scripts: You'll need to modify the Game_Character class (or any other relevant class for events, etc.) to implement your own collision detection logic.
Pixel-Based Collision: This approach involves checking individual pixels of the sprite against the tile map or other objects.
Bitwise Operations: You can use bitwise operations for efficient pixel-level collision detection.
Option 3: Multiple Sprites for Complex Shapes
Create Multiple Sprites: If you need a very complex collision shape, you can create multiple sprites that together define the collision area.
Follow and Adjust: Ensure that these sprites follow the main sprite and adjust their positions accordingly.
3. Implementing Custom Collision Checks
Locate relevant scripts:
You'll need to find the Game_Character and Game_Map scripts, as these are responsible for handling movement and collision detection.
Important Considerations:
I'm using Victor Saint's Pixel Movement for compatibility.
Here's a masked example. Before, after:
This is how I requested this script. The masked sprite contains collision. Event characters are not the only sprites that have collisions. A collision folder should be necessary for masked sprites. You could implement a masked folder instead if you like.
EDIT 1: I could use the collision mechanic like Rosedale Collision Altering. But, I'm using the VX Ace version. I now include tilesets to mask for collision. I don't want to use a 'B' word to keep this thread alive. It's not a bad word I censor, it's about **** into someone. I gave you a hint on this. It's just I don't want to break a rule, not knowing where the rules post is.
EDIT 2:
A custom collision mask in RPG Maker VX Ace can be achieved through scripting by altering the standard collision mask of sprites or events. This involves modifying the Ruby scripts within the RPG Maker engine to define the collision area based on the actual sprite image instead of a simple rectangle.
Here's a breakdown of how to create a custom collision mask:
1. Understanding the Default Collision System
RPG Maker VX Ace uses a tile-based collision system, where characters and events are considered to occupy a grid of 32x32 tiles.
By default, the collision area of a sprite or event is a rectangle based on its image dimensions.
2. Creating a Custom Collision Mask
Option 1: Using the sprite as the collision mask (Precise Collision)
Enable Precise Collision: Set the sprite's collision mode to "precise" in the sprite editor.
Define the Collision Area: The engine will then use the actual pixels of the sprite to determine collisions, allowing for more complex shapes.
Option 2: Custom Scripts for Collision Checks
Modify Scripts: You'll need to modify the Game_Character class (or any other relevant class for events, etc.) to implement your own collision detection logic.
Pixel-Based Collision: This approach involves checking individual pixels of the sprite against the tile map or other objects.
Bitwise Operations: You can use bitwise operations for efficient pixel-level collision detection.
Option 3: Multiple Sprites for Complex Shapes
Create Multiple Sprites: If you need a very complex collision shape, you can create multiple sprites that together define the collision area.
Follow and Adjust: Ensure that these sprites follow the main sprite and adjust their positions accordingly.
3. Implementing Custom Collision Checks
Locate relevant scripts:
You'll need to find the Game_Character and Game_Map scripts, as these are responsible for handling movement and collision detection.
Ruby:
# In the Game_Character class
class Game_Character
def move_straight(direction)
# ... existing code ...
# Check for collisions using your custom collision mask
if check_custom_collision(direction)
# Stop movement if collision detected
return
end
# ... rest of the movement code ...
end
private
def check_custom_collision(direction)
# Implement your pixel-based collision check here
# This is a simplified example, you'll need to adapt it to your specific needs
case direction
when 4 # Right
# Check if the right edge of the character's collision mask is colliding
return true if $game_map.tile_passable?($game_map.get_tile_passability($game_character.x + 1, $game_character.y))
when 6 # Left
# Check if the left edge of the character's collision mask is colliding
return true if $game_map.tile_passable?($game_map.get_tile_passability($game_character.x - 1, $game_character.y))
# ... Add logic for up and down directions ...
end
return false # No collision detected
end
end
Important Considerations:
- Performance:
Pixel-based collision can be computationally expensive, especially for complex shapes.
- Complexity:
Implementing custom collision masks can be complex, especially for non-rectangular shapes.
I Copied this from AI Overview, to make it easier to understand.