Kincaid's Forum Posts

  • Well, 8 days now...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • One of my posts is waiting for approval for 3 days now. My other posts didn't need to be approved at all. Why is this?

  • Thanks. I'll try that.

  • I tired searching for a solution, but most of them where several years old and complicated. I hope there is something better now.

    I have a layout that is much bigger then the viewport. The viewport is following the player. Now I want to spawn an enemy every x seconds inside the viewport. I'll do it like this:

    Every X Seconds > create object on layer 0 at (random(64, Layoutwidth-64), random(64, LayouthHeight-64))

    This should for spawning the enemy somewhere in the layout. But I want to avoid spawning an enemy in the viewport. In the best case it would just look awkward, in the worst case the enemy would spawn directly in front of the player.

    I know I could spawn them outside the viewport and then let them move into the layout but there is a barrier around my level which means the player could see that the enemy is just walking over it. Also this would make it harder to keep the enemy inside the layout once it entered it.

    So, what is the easiest way to prevent an enemy from spawning in the viewport? Spawn it randomly and right after it spawns check if its in the viewport and if yes move it randomly again and repeat this until it spawned outside the viewport? Would the multiple spawning happen at the same frame or will the player see the enemy flash for one frame? How do I prevent the enemy from randomly changing it's position when it later legally enters the viewport?

    Create 4 spawn areas around the viewport, north, south, west and east of it. I think of something like

    create object on layer 0 at (random(64, ViewportLeft), (random(64, LayoutHeight-64))

    Make this for alle 4 directions and randomly pick one?

    Or is there even just an option to set that says "don't spawn in view port"?

    Conpletely different solutions?

  • I'm trying to achieve enemy movement with the following rules:

    Movement is restricted to a 32x32 grid.

    - If the enemy is in the same row as the player it should turn left when the player is to its left or right when the player is to its right

    - If the enemy is in the same column as the player it should turn up if the player is above it or down when the player is below it

    - If both conditions are not true the enemy checks its distance to the players column and row and turns towards the player on the axis where the distance is closer.

    This is what I have:

    This works basically but not consistent. They mostly turn only when the player crosses them but not when skelAbsDistX becomes smaller then skelAbsDistY. Also I start with 2 enemies on the screen and then spawn a new enemy every 3 seconds. The first two enemies immediately start moving, the others don't, even when I set the initial value for their direction variable to "right". They only move when I cross them and sometimes just crossing is not enough, I have to move on their row or column for 1-2 tiles.

    Any idea why this happens? Maybe the random spawning and the tile movement conflicts because they don't spawn correctly in the grid?

  • I am trying to create a health bar. It's just a red sprite that changes it's width according to the players health. Problem is that the position of the health bar is set at it's center. When I change the width it gets shorter on the left and the right side.

    How do I move the origin of the sprite to the top left so that the left side of the sprite always stays at the same place when I change the size of the sprite?

    (I hope I was able to make clear what I mean, I am still lacking the correct terminology.)

  • Because I need a background behind the text to make it readable. I thought a text box would be a quick and dirty solution for this. Turns out it’s not. I have trouble resizing it to a readable size. I could use a simple text and a sprite as background. But it’s not worth the effort. I think i‘ll get rid of the tooltip completely. I can’t manage to create a good substitution for a mouseover on touchscreen, it completely messes up my „on object touched“ and it works without the tooltip. Too much trouble for a little convenience.

  • I have multiple sprites (no animation) and a spritesheet with all the sprites. Later I added a sprite to the sprite sheet and I expected that all the sprites I already have in my layout automatically update and have this new sprite available. They didn't. Do I have to replace all animation frames for every single sprite with new spritesheet or is there a way to reload the edited spritesheet with all sprites at once?

  • I'm trying to implement a tooltip. I have a textbox that shows when you hover over a sprite, but I have a problem with the size of the textbox. First thing I tried was resizing the text according to the text length but I found this isn't easily done. I'm okay with the box being the same size no matter how long the text is. But no matter how big I set the textbox in my layout, in the browser it has always the same size. I even tried to set the width via "on start of layout", but it still doesn't change. Why is this? How do I resize the textbox?

  • Strange. What I tried yesterday was a condition "touch is NOT touching object" -> set textbox invisible. It didn't work yesterday. I tried it again and now it works. Don't know what was different yesterday.

    Anyways, problem solved. :)

  • I don't understand. You mean an event with two conditions, one that checks if the user is not touching an object and one that checks if the textbox is visible? I can't find a condition "is visible" for textboxes.

  • I try to create a supplement for showing a tooltip per mouseover for touch controls. I have a textbox that is invisible at the start. When the user moves with his finger over the screen and touches a sprite the textbox becomes visible, the position is set to some place over the finger and the text is set to a variable of the sprite. This works. But I want the textbox to become invisible again when the user doesn't touch the sprite anymore. "Is touching object" + "On any touch end" doesn't work here because "on any touch end" doesn't become true. The user is still touching the screen.

    How do I create an event that triggers when the user releases an object but still touches the screen?

  • Sounds good, but unfortunately families are not available with the free license.

  • Hey, I have a map where you can manually check different locations after you visited them, locations are represented by sprites that lie over the map itself. If you click that sprite the color changes from white to black. Is it possible to create one sprite and all events needed and then clone that sprite to use it for the next location without creating all the events again? Or is there an easier way?

  • Allright, thanks. Sorry again for hijacking this thread. Back to topic now.