Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

Prefect Pixel Collision, How to Impliment?

Sethorion

Towns Guard
Xy$
0.00
I'm trying to implement this plugin so that my character can slash at events and cause damage on collision, but I'm having trouble with the code (still new to Javascript).

What I've done:
- I created a sword-slashing animation that is listed as a common and event, and pressing "A" will trigger the animation. This works.
- I created a simple event (EV030) with a Bat as the image and told it to approach the Player. This works.
- In the bat event, I created an 'if' call with $gamePlayer.collidesWith(EV030) as the condition. The event trigger is set to Player Touch. When I interact with the bat event in-game, This results in ERROR: EV030 not defined. I believe the error shows up when the event is activated, regardless of any 'slashing'.

The $gamePlayer is properly defined (I looked in the rpg_sprites.js to find the player's proper name). How do I find the name of the bat event? Or does it even qualify as a sprite that works with this plugin? I tried the traditional event name (EV030) with and without $ in front, but neither worked.

And (not to overload this post with questions, but...) will my common event animation trigger this event?

upload_2016-8-7_16-49-55.png
 

Attachments

Dad3353

Praised Adventurer
Have you tried using simply the Event ID on its own (just plain old 30...)..?
I'm not sure just how precise this collision has to be; I have an Event (a free-flying bird, above the Characters...) which has to interact upon collision, which is impossible, as the Event is Above. I solved this by tracking the X-Y of the bird and Hero with a Parallel Event, if they coincide, then Action (Swoop down and steal something, in my Game...). Would that not help with detecting 'collision' in your case..?
 

Sethorion

Towns Guard
Xy$
0.00
I tired 30 as the ID and the error changed to "undefined is not a function." I guess that is progress...?
I want the collision detection to be pretty precise. This plugin that I'musing is able to dtect whether pixels from one sprite (like a sword, in this case) make contact with the pixels from another sprite. If so, the function should do damage.
 
Top