nico_pons's Forum Posts

  • 15 posts
  • cool! this is pretty much exactly what I needed. I wish I could have made it work without adding an extra variable to store other UID but it looks like it works super well so I will stick to this solution for now. Thanks so much

  • Hi friends, I have a system where instances of an object will go towards an objective, and once the objective is destroyed they will go towards the player.

    Right now they will bunch up at some point, and look like they are the same object.

    I'd like to have a line of code to make the instances repel eachother with a lerp to avoid this interaction. gyazo.com/a928673171ef887f3a58962f0d5326ed

  • Since you have all snake parts as separate objects, you need to add them to a container. Then in the "SnakeHead On Created" event all its parts will be picked automatically, and pinned correctly to each other.

    You may need to add "For each SnakeHead" to your event #4

    Hey, so I had a followup question on this. I have an effect I implemented previously where there's a nice chain explosion on the snake. with the containers, every object in the container is destroyed if another object is destroyed. this makes it hard to use my chain explosion. is there a way to modify my container to allow it to let other objects stay in the scene when destroyed?

  • Oh, by looking at alextro's solution I realized something I could do is have the snake start one section ahead of the snakehead, and have the snakehead point to it.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Tag system for flexible use & modularity with only 1 object family:

    https://www.dropbox.com/s/xfdap5rv93wusie/snake_body_pin.capx?dl=0

    This looks like exactly what I'd want! I'll try reworking this solution for myself tomorrow morning as it's getting quite late for me!

  • Since you have all snake parts as separate objects, you need to add them to a container. Then in the "SnakeHead On Created" event all its parts will be picked automatically, and pinned correctly to each other.

    You may need to add "For each SnakeHead" to your event #4

    I just tried this and it works quite well! gyazo.com/0a82f56b6096b22f7227e4d4afabe97b

    there seems to be one issue though where the snake head with inverted movement is flipped. I think there's an equation to determine angle of movement which I should probably be using to determine the angle of the snake head instead of just using the behavior's set angle.

  • Not sure what the problem is? Create a second snake and pick it with events, or create completely new objects for a second snake it's up to you.

    Right, I understood this was a possibility but this is sort of what I wanted to avoid. I envision levels with potentially 10+ instances of snakes with different movement and I want to take the opportunity to learn how to avoid remaking it entirely every time.

  • does it work if you take physics out of the equation?

  • I've coded and designed a snake for a shmup game I'm pretty happy with.

    gyazo.com/ea39742e5f67a376be0c974c35c6f0ff

    I know the code is not the cleanest, but I got the movement I wanted and that was my first step

    gyazo.com/af7ce9a7cea3c9eb0a20b061ec5be0b0

    Right now, I cannot just copy paste the sprites of the first snake and roll as that will cause everything to pin to itself twice and mess with the movement.

    I want to create one sheet of code which would let me have independent snakes.

    This way I'd be able to adjust each one's movement independently.

    thanks so much for replies, also happy pride friends!

  • Hi everyone, I'm going through the exercise of programming Conway's Game of life.

    My current issue is that I have syntax that makes a lot of sense to me, and seems like it's correct other than no looping prevention, but nothing actually changes in my instance variables when I run the debug.

    My current goal is to be able to add 1 to an instance variable neighbors for every tile that is alive and adjacent to the original tile being checked.

    My code is as following:

    If the tile that is overlapping (original tile position)+n is alive, then add 1 to Original tile Neighbors.

    do this in all directions. (x+32,x-32,y+32, etc.)

    Right now it's setup to only do this for the first tile, but it seems to be doing nothing.

  • I'm in love with this example. Thank you so so so much for helping me out with this. It's so much more clear now, and it's crazy to see how many fewer lines of code it needed. It's cool to see you even included a randomizer for different frames.

  • I'm really sorry to ask this so bluntly, but how would I actually implement this code?

    I"ve been trying for the past hour to just get something resembling and I genuinely feel like I'm just not aware enough of construct syntax to get it going.

    What I currently have is a system where I've tried to replicate the exercise best I can as you described, but everything gets deleted, as opposed to just the objects of a set type.

  • I'm trying to figure out functional code for my students game.

    My goal is to eventually create a game where I can click on a fruit, and a for loop can check through each fruit adjacent, and determine whether or not it matches.

    If it matches, and there are more than 2 matching fruit in a chain, then destroy all fruits that are in the chain.

    What I'm trying so far, is to manually select fruit and check if all fruit in that selection match. If they do match, and they are right clicked, delete all the matching fruit. How would I manage just this?

  • thank you guys so much for the explanation, this definitely makes one part of my puzzle a lot simpler to code!

    There's one part that still stays confusing for me which is the activation of each light. Part of my puzzle is that a light will activate itself plus the next light instance in order. For now I just have it hard coded

    Would there be a solution to have it turn on self and (self)+1?

  • I checked up on the documentation for family properties, but I still have some questions.

    I am trying to make a simple puzzle where turning a light on adds 1 to a counter, and turning a light off removes the addition from the counter

    I have a master event that sets the total lights value to be each light's value manually (Light1.value+Lightx.Value-etc.)

    Does anyone have better ideas for a system to check through each light and do this without recoding it every time? I can imagine making a puzzle with 10 lights will start making this process annoying

    Is there a check every instance in this family type of thing? I've had problems earlier with incorrect addition when I've tried other methods.

    I have it working right now but I just want to be more efficient about it.

    Alternatively if this would work better with another system I'd love to hear about it.

    Code to start process

    Code to set values

    Code to add values together to global variable

    Tagged:

  • 15 posts