JeremyBenson11's Forum Posts

  • It must the scroll to object! lol, like you said. I'm going to have to mess around with attaching a blank sprite to the selected unit. That way when the player zooms out it will zoom in on that player. Sorry I didn't understand what was going on here.

    So, just wondering. When I set up mouse to drag the map, or mouse drag scroll, based on another tutorial, will this work differently? Can I set scroll to, to the mouse? or something?

  • There must be one little thing I'm doing wrong. Even when I copy and paste your events to my file it doesn't work the same. Have you set anything besides the events? Is there something special set in the game window, in the layers? What is Var1 set to?

  • Scroll to isn't a possibility. There are going to be selectable units on the map not a single character. The tutorial I just watched worked fine on YouTube. I just downloaded the latest version of Construct 2 and bought a personal license. I have no idea why this isn't working right.

    I'm gonna check out your file though Thanks for taking the time. If this doesn't fix I may need to try to get a video of the problem up..

  • Okay, I must have a bug. I'll check around. I'm going to update Construct to the latest version, and see if that was the problem.

  • The weird thing is, I'm watching a YouTube video where the person sets the layout scale to 0.5 and zooms in again by setting the layout scale again, and it works great. Simple. I do the same thing and it does not work the same. There are no errors. When the scale is zoomed out below 0 and back in again everything is shifted up and to the left, and the zoom is not normal, and sprites are not where they started.

    youtube.com/watch

  • This is the thing though. Your min zoom is 1. That means you're only going to be able to zoom in and then zoom out to normal zoom. This works for me too. But I'm not trying to focus on zoom in.. I really want a zoom out. Like what you would do if you were playing and rts and wanted to see more of the map..

    When I zoom lower than 0 and zoom back in the objects are not where they started. It never zooms back to 1 properly after going below zero

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey, thanks for the post. It's not working though.

    Key arrow up - set layout scale to 0.05 * dt

    Key arrow down - set layout scale to -0.05 * dt

    When I press up the sprite just vanishes. Do you think you could post a capx, or anyone else? I can't post mine because of low reputation.

  • I've got a simple set up with a zoom variable. Set the layout scale to the value. Use up arrow to zoom in and down to zoom out. The problem is the best zooming is in. You seem to have to set the zoom scale to 1 in order to get the zoom to lerp to normal. The problem is this allows for no zoom out. I guess when the value of scale layout hits zero some other internal calculations get fishy.

    What's the most graceful way to zoom below zero, and get back to 1 when zooming out?

    Thanks for any advice offered

  • This is very confusing. Passing an object doesn't seem to help me in my case. I really need to access every object in a layout. I couldn't find a way in Construct to do something to an object by name. I could store text values in an array, as names of items, which are actually sprite names

    array[0] = 'hat'

    array[1] = 'boots'

    You can loop through an array with a foreach... but there doesn't seem to be a simple way to move an object name.

    I figured I could make a simple plugin for my game which created an action that moved an element to X,Y simply based on sprites name.

    Also I would have a corresponding expression... Then I could use the foreach to loop through the elements of the array in my layout then for each value call the expression move(element, 12, 12), say.. that would put the item of that element at 12 12. I could call the expression for each value in my array and move a whole array of items where ever I wanted.

    I'm not that good with this kind of stuff, so figured if I could loop through each object, that would do it.

    Other wise I was stuck with a ton of events, acting as a pseudo switch.

  • I think I found something that might be useful to me.I need some clarification.

    What I see is this:

    runtime.types_by_index[]

    An array of all the object types in the project.

    What would be in that array? Would I be able to access objects from there?

    Also the page says this:

    The runtime object represents a single instance of a user's project running in the browser. It is usually accessed via this.runtime from an object instance. Remember only documented properties and methods should be used.

    What does it mean. The run-time is accessed form an object instance? Does this mean an instance I would have to pass as a param? If so, that kind of defeats the purpose of what I'm trying to do.

  • I'm not really seeing what I need in there. I'm looking for a way to loop through all the objects in a layout. So that I can run a specific operation on the object with a certain name.

  • Hey thanks Gigatron, what's mutuware Circle Behavior? Third party?

  • Borgi, I tried your formula like this:

    mouseX = enemyUnit.X + cos(random(360)) * random(100)

    mouseY = enemyUnit.Y + cos(random(360)) * random(100)

    Then move towards the location like this:

    set x = lerp(enemyUnit.X, enemyUnit.mouseX, 1 - 0.5 ^ dt)

    set y = lerp(enemyUnit.Y, enemyUnit.mouseY, 1 - 0.5 ^ dt)

    The problem is the each turn the unit seems to move less and less distance, and usually in the same direction. Is there something that would trip this method up? Should I be setting mouseX and mouseY to zero at the end of each turn.

    The game goes player turn move up to 100 px if there is a target in site, fire up to 120px. Same for the enemy unit.

    I know this isn't goo ai at all, but I'm just learning some basic concepts. Knowing how to move set pixels in a random direction is good . I also have to study math.

    I'm gonna check out RamPack's capx now. That seems like a simple and interesting method..

  • What is the best way to move a sprite to a random point within line of sight. Say my sprite has a line of sight that is 100px. How can I pick a random x,y that is a random angle, and then move the spite random(1, 100) PX to a point on the line.

    ugh, math is confusing.

    Basically the sprite can move to one point in any direction, but only up to 100px

  • Ah. I see what you're saying. More of a design issue than anything. Thanks for the info.