Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: Collision Detection  (Read 5647 times)

0 Members and 1 Guest are viewing this topic.

Chaos

  • supporter
  • Lurker
  • *
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 45
  • "WME rocks!"
    • View Profile
Collision Detection
« on: October 25, 2014, 07:52:41 AM »

Hello Muties! Listen guys I really need your help on this one... On my new game there is an arcade sequence where you are inside a ship's cockpit on outer space and you battle other ships that try to destroy you.(It was in fact, inspired by a similar arcade sequence that I saw on an AGS game.) The first thing that I did was to make an special cursor that appears everytime that you hover the enemy's ship. And how I actually managed to simulate a laser that shoots out everytime that you click? I made that everytime that you left click over the Ship (Entity) it creates an actor (Phaser) that appears at the bottom of the screen and then this goes automaticaly to the ship, get it? (And it really looks good, actually) So now my problem is there a way to know when the Phaser (actor) collides with the Ship (Entity)? I hope that I can really find a way because I've already done most of the graphics of the scene and It would certainly break my heart to discard this from the final game. Thanks! :)
« Last Edit: October 25, 2014, 08:04:52 AM by Chaos »
Logged

HCDaniel

  • Regular poster
  • ***
  • Karma: 8
  • Offline Offline
  • Posts: 168
    • View Profile
Re: Collision Detection
« Reply #1 on: October 26, 2014, 05:47:44 PM »

I don't know if it will help you, because it would mean for you to compile WME from sources.

In my wme branch (https://bitbucket.org/hardcoredaniel/wme1-rapaki-edition), I have added a functionality which might be useful for you. The changes to WME are this one commit:

https://bitbucket.org/hardcoredaniel/wme1-rapaki-edition/commits/4bb8b5772fdcd30de18ef5be2c38d292a9dc2905

and the one relevant change from this commit that fixes a previous error on my side:

https://bitbucket.org/hardcoredaniel/wme1-rapaki-edition/commits/c577842f67312f498d31c9f45057af3e51da8f37

The idea behind this is to utilize when an actor is being "blocked", i.e. the actor cannot move into the "originally intended" direction anymore. The change in the engine will generate an event that you can use for your purpose (called "ActorIsBlocked") and there is also a field "ActorIsBlocked" for every actor to check which ones are blocked.

Additionally, you can override the default behaviour of the engine, which tries to keep the actor moving using a new path around the blocked region. When you call the function "SetStopOnBlocked(true)" then the actor will simply stop walking.

I did not have the time yet to create a pull request for the original WME source tree, to have these features included eventually. My branch might contain other stuff which you might not want, so I cannot recommend to use it over the original WME.
Logged

Chaos

  • supporter
  • Lurker
  • *
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 45
  • "WME rocks!"
    • View Profile
Re: Collision Detection
« Reply #2 on: October 27, 2014, 11:53:11 PM »

Quote
because it would mean you to compile WME from sources.
Did you actually meant changing the source code from the engine itself?  ???
« Last Edit: October 28, 2014, 12:01:52 AM by Chaos »
Logged

ciberspace

  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 116
    • View Profile
    • Tele Juego
Re: Collision Detection
« Reply #3 on: October 28, 2014, 08:35:02 AM »

HCDaniel

  • Regular poster
  • ***
  • Karma: 8
  • Offline Offline
  • Posts: 168
    • View Profile
Re: Collision Detection
« Reply #4 on: October 28, 2014, 08:55:09 AM »

Yes I meant to modify the sources of the engine. But ciberspace has posted a better solution with way less effort  :)
Logged
 

Page created in 0.031 seconds with 19 queries.