Jump to content


Photo

Ranged Interaction in Rm2k3? I need your help!


  • Please log in to reply
8 replies to this topic

#1 the_nackster

the_nackster

    Advanced Member

  • Members
  • 692 posts

Posted 17 October 2009 - 07:25 AM

So in two of my projects I need the ability for an object referenced by x & y coordinates to be able to cause a "collision" with another object. Now I am able to get the mechanics working perfectly, where the object comes to hero and then is flung outward, now my question though is how can i get this object to interact with other objects when flung foward?

Let me put this simpler. I have a bullet with X Var stored in 00-, and Y in 00-. Now when the 00-,&00- coords line up with the x&y coords of an enemy I have a generalized action like: Flash, Switch: Erase enemy on... etc. But what ends up happening is that the enemy dies as soon as the map loads or the bullet just goes straight through him. What am I doing wrong?

I'm sorry if im not explaining this well, so here is some pics to help you understand what im saying

Posted Image
This Tracks the enemy and the bullet (bullet labeled fire) I also have another event tracking the hero not pictured here.

Posted Image
This references the bullet and calls it to the hero location before projecting it foward.

Posted Image
This is the actual enemy script, set to run as a parralel process.

Does anyone see a mistake I dont? Am I doing something wrong?
$280 USD Donated GamingW

F*CKING Awsome Games that I support!

Posted Image

Posted Image

#2 Mineyl

Mineyl

    Advanced Member

  • Members
  • 95 posts
  • LocationElrit Forest

Posted 17 October 2009 - 07:30 AM

If they're dying as soon as the map loads, it's probably because this process is activated while all of those variables are still set to 0, meaning that they're all equal, meaning that they die instantaneously.  To fix it, you need to have that first box of code you pasted run BEFORE that final one that is on a parallel process.
Posted Image

#3 the_nackster

the_nackster

    Advanced Member

  • Members
  • 692 posts

Posted 17 October 2009 - 08:10 AM

ok that fixed him just dissapearing, but now the bullet just passes directly through the enemy, doing nothing.
$280 USD Donated GamingW

F*CKING Awsome Games that I support!

Posted Image

Posted Image

#4 Killer Wolf

Killer Wolf

    Advanced Member

  • Members
  • 854 posts

Posted 17 October 2009 - 08:11 AM

I think Mineyl nailed it. In a system like that, you always need to declare your variables before you reference them. I usually put the tracker for the player's projectile at the top of the collision detection event and let the enemy variables update via a parallel process.

The problem of the bullet going through the enemy without triggering the collision is a little different. I've noticed every now and then that a moving enemy and a moving projectile can seem to pass through each other. I threw in a couple events to let me track the variables in real time and I found out the problem. Depending on the movement speeds involved, the enemy can be moving from one coordinate to another during the overlap. Also, depending on the number of actions within the event, as well as any delays you include (wait 0.0, etc), the sprite's position might differ from its last tracked variable position giving the appearance that the bullet is passing through without triggering a collision

There is probably a more technical way to fix it, but I just messed around with my projectile speed some until I found a rate that seemed to eliminate the problem.


Vagrancy - Be careful who you wake up in a twenty four hour parking lot.

His name was Not Johnny -  A young man becomes a sort of superhero after a crippling injury. He

#5 the_nackster

the_nackster

    Advanced Member

  • Members
  • 692 posts

Posted 17 October 2009 - 08:29 AM

The enemy in question is stationary. And even after twiddling with the animation speeds its still just passing straight through. Does anyone know the "more technical" way of fixing this?
$280 USD Donated GamingW

F*CKING Awsome Games that I support!

Posted Image

Posted Image

#6 Killer Wolf

Killer Wolf

    Advanced Member

  • Members
  • 854 posts

Posted 17 October 2009 - 08:38 AM

Have you tried it without setting the projectile to slip through/phasing? This could be your problem right here. Just set it to "over hero" and see if that helps.
Vagrancy - Be careful who you wake up in a twenty four hour parking lot.

His name was Not Johnny -  A young man becomes a sort of superhero after a crippling injury. He

#7 the_nackster

the_nackster

    Advanced Member

  • Members
  • 692 posts

Posted 17 October 2009 - 08:45 AM

Unfortunatly this still does not solve my problem. Im seriously pulling out chunks of hair over this.
$280 USD Donated GamingW

F*CKING Awsome Games that I support!

Posted Image

Posted Image

#8 Killer Wolf

Killer Wolf

    Advanced Member

  • Members
  • 854 posts

Posted 17 October 2009 - 09:15 AM

Did you try assigning the variables for the projectile at the top of the collision detection event? Since I'm half asleep and on pain killers right now, so I'm probably missing a really obvious fix, so here are some shots of my events from a working abs shooter. It looks to me like we're doing pretty much the exact same set of operations, but for some reason you're not getting the same results.

Excuse all the extra trash in my 'code'

[hide=Variable assignment event - Parallel]
Posted Image[/hide]

[hide=Collision detection event - Parallel]
Posted Image[/hide]

[hide=Input processing]
Posted Image[/hide]

[hide=Bullet Event]
Posted Image[/hide]


Vagrancy - Be careful who you wake up in a twenty four hour parking lot.

His name was Not Johnny -  A young man becomes a sort of superhero after a crippling injury. He

#9 the_nackster

the_nackster

    Advanced Member

  • Members
  • 692 posts

Posted 17 October 2009 - 09:28 AM

success! It would seem that simply putting a .5 second wait WITHOUT defining a coord for the bullet before ANY process  begins, made it work. Thanks for all your help KillerWolf!
$280 USD Donated GamingW

F*CKING Awsome Games that I support!

Posted Image

Posted Image




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users