Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

darkdrewmo

2
Posts
1
Topics
A member registered Mar 15, 2016

Recent community posts

I don't know if anyone will tell you exactly how to do it, but start with this:

Figure out how to find the location of the player,

Figure out how to spawn an item at the players location,

Figure out how to add velocity to the spawned items toward your desired location (mouse pointer? directly forwards?)


I would look at the example projects like: https://sparklinlabs.itch.io/pirates-from-the-future and look at the scripts that control the cannons.

What I am trying to accomplish is if an my object collides with something I would like to check and see what the collision is, then if it is a specific actor I want to check what animation is playing on that actor. I am unsure how to get the actor from the collision. see example below for what I have right now.

if (Sup.ArcadePhysics2D.collides(this.actor.arcadeBody2D, Sup.getActor("collision").arcadeBody2D) { 
   if (Sup.getActor("collision").spriteRenderer.getAnimation() == "animation1") { 
      //do something... 
   } 
}

After this step I am going to make a generic function so I can do whatever I want without needing to put this code everywhere. Something like:

collidesWith(target, animation) { 
   if (target.getAnimation() == animation) { 
      //do something.. 
   } 
}

My current issue is I don't know the proper way to get the actor that was involved in the collision. For example if a car collides with a wall how can I reference that wall's actor with a collision script inside of the car?

I had posted this on Reddit too, I will update either posting with the working response.