Ottomic's Forum Posts

  • 11 posts
  • Thanks, guys. It's taken me the better part of a week, but I just made a decent A* function by scanning adjacents and then backtracking the same exact way. I dunno how efficient that'll be when more entities come into play, but at least it's reasonably solid with a start and destination point. Thanks again.

  • Hi. I'm projecting a builder game of sorts, and I'm having doubts on the core pathfinding function. Lemme explain:

    I have an environment defined by an array with two Z levels. The first one is for tiles (1 or 0), the other one is for entities (by ID).

    The environment is defined by either 4x4 rooms, 2x4 corridors, or 3x3 corners. All connections are on a grid.

    I want an entity to first scan for points where it wants to go and then plot possible paths to said destinations. Once it has done that, decide for the shortest path (eg, "I'm at 3,5, there's a point at 10,6 and another one at 6,10, which one is the shortest accounting for the shape of the playing field?).

    The pathfinding function included in construct2 is not really cutting it for me, because it moves the sprite along a grid. What I want is to run it for every possible destination, and return a length in tiles *before* moving it, as the game will be rendering every .3 seconds and I need the entities to move one tile every time the game renders. I would also need to be able to stop it and re-run it if the path became obstructed while the entity is on the move.

    Really filthy casual developer here, so any pointers would be appreciated.

    Thanks.

  • Hi. I'm trying to do a game that uses a beat'em'up-style perspective. The tech demo I've been working on is here:

    ottomicgames.freeiz.com

    I'm implementing enemies right now, but I have a problem that's nagging me since I've started working in the game and that I would really like to solve: I need to know what's the distance between an object and my player while accounting for the perspective. For example, I'll set an enemy to "prowl" (i.e: move in circles) around the player at a certain distance. However, the enemy will do so at (let's say 200) pixels always, but what I want is for it to prowl at such a distance that while its absolute X and Y might be different from 200, it's really at 200 "tile-pixels" from the player. I hope I'm explaining myself here. I've been looking around, but I haven't found a way to do so without tons of math and projections, and I would like to know if someone has a quick or easy way for me to achieve this with Construct. Thanks in advance! <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy" />

  • Tried it, works like a charm. Anyone interested in levels of variable length, don't bother with layouts. Just spawn everything off-layout, turn unbounded scrolling on and then scroll over them.

    Thanks for the tip Ashley, I had heard about unbounded scrolling, but I wasn't sure it would help me, but you just saved me a lot of time.

  • Don't create a layout of maximum size. Just set 'unbounded scrolling' to 'yes' and implement the scrolling bounds yourself.

    Oh! So, I could preload all the level offscreen and pass the layout over it with unbounded scrolling? That would be ideal. Gonna try it out.

    Thanks!

  • Hi everyone. Sorry if this was mentioned before, I couldn't find anything on what I'm looking for. I'm making a procgenned game that can generate levels of various sizes, and I can't find how to set the layout's X without altering its Y size.

    I want to first set a layout size according to how many "screens" the level's length should be (multiples of the game's resolution, so I can take advantage of the game's scrolling) before generating the level, but I can only find a function to set the layout's SCALE, not just X or Y.

    Could you please tell me how to set the layout's X value to a variable while ingame? Is that possible? Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sure thing, I would have liked to find something like this when I was looking into Beat'em'upper movement, or hell, any kind of movement in perspective anyways. It could be more streamlined, but since most of the code is taken directly from my game project (where all the variables and stuff make way more sense) I decided to keep that since it makes the system more versatile all around. Please note that the placeholder graphics for the player are from the Scott Pilgrim game, and as such I don't own them, just in case.

    Anyway, yeah, I really hope I can get it through. I'm working on a system that can allow huge procgenned levels while keeping the onscreen elements at a minimum for a big, awesome B'E'U/RPG of sorts, and even though I wouldn't hold my breath for it, with a community like Scirra's I'd say it's even possible I can make it through. :)

    Thanks again, hope I can help someone in the process, too.

    dropbox.com/s/ir84j5jurqeg42z/Movementsystem.capx

  • Well, after working on the movements mechanics for a couple days, I thought it would be helpful to make a mini-update with the overall results. In the end, I've decided to go with the original idea that I posted on this thread.

    The reason behind this is that once I had nailed the deceleration mechanics (which I made with an acceleration at player.movingangle-180), this kind of movement becomes pretty much the same as the behavior, only you can store the values for acceleration and deceleration on the player as instance variables (which is kind of pointless, but I like it that way), and what's more important, although cincipon's solution is really elegant and looks easier, the movement speed stacks up when pressing Up and Left, and Down and Right. At least, it serves better the purpose I need to give it.

    So, thanks a lot, everyone. I hope I'll be able to post my full movement system so you guys can take a look at it. Cheers!

  • Player.8Direction.VectorY < 0 -> Player>Set X>Player.X+(0.01 * Player.8Direction.Speed)

    Player.8Direction.VectorY > 0 -> Player>Set X>Player.X-(0.01 * Player.8Direction.Speed)

    The 0.01 * Speed is because if you just do a linear value, it makes an S shape as you accelerate/decelerate.

    If you want to tweak the amount, start by trying 0.015 or 0.005. It is that sensitive =P

    Alright, that was amazing. It is exactly what I was hoping for when I posted this.

    I'll be playing around with the 0.01 vector so it matches my perspective, but other than that, this works like a charm, and I prefer sticking with that for the moment, rather than the Custom Movement.

    Thanks a lot, cincipon! :D

  • Alright, so I've been experimenting a bit more with Custom Movement and I seem to have resolved the main issue I had with this control type: deceleration. I didn't want to use it because, as much as I had tried, I couldn't set a proper deceleration mechanic, which 8-direction includes.

    Anyway, I just sat down and looked at it for half an hour or so and I've been able to actually get a working deceleration mechanic. I'm attaching it to this reply, since although it is incredibly primitive it would have helped me immensely 24 hours ago. It's amazing what just doing something else for 2-3 hours can do when you're stuck with a problem.

    (link to .capx)-> dropbox.com/s/sweho4etr70k4jr/custommovement.capx

    Anyways, I'd appreciate if anyone has any improvements on it. Thanks a lot, and sorry for the typos on the original message-- I was writing it from my cellphone.

  • Hi everyone:

    First of all, sorry for not attaching a .capx file. I think this is more of a theoretical question,.

    so it doesn't really need one. However, please tell me if you nee one.

    qa

    Consider a side-scrolling beat'em'up game where the floor is at an angle (GoldenAxe, Aliens vs Predator arcades). I want my character to move freely on 8 directions, except I want all entities to move at angle when moving on the Z-plane (to or away from the player).

    Now, the problem is, there seems to be no way to alter the angle of movement on a 8-direction behavior, and I have tried setting up custom movement to no avail (deceleration is broken as far as i'm concerned on Custom Movement)

    My ideal solution would be to modify the angle at which the game moves sprites binded to 8-dir behavior. Can this be done?

  • 11 posts