Two Newb questions

This forum is currently in read-only mode.
From the Asset Store
This is a Dungeon Master tool & the 1st of 12 Combat Engines from the Building Combat Engines for Browser Games workshop
  • I just got my hand on construct and it is brilliant, however I am very crappy at making games even with simple games even with program like construct, please bear with me. I am trying to make a simple tower defense game at the moment

    #1: I am trying to make a predictive aiming turret, I found the template Aiming and the math or code blew my mind. So i gave up on that and I found a check box for predictive aiming for the turret behavior. However the aiming didn't get any better with it checked or not. What is the problem?

    #2: I have a Turret which shoot cannonball, it is 2.5D view so it got a base. I put the cannonball on the bottom layer and it fires off benefit the tower sprite, however the base of the tower also covers the cannonball which makes it look awkward when it shoots down. Is there a mask or some effect which can fix this.

    Thanks for the help people.

  • use image points for spawning the cannonball, helps with what ur experiencing

  • I set the image point to the top of the tower, so it spawns at the correct place, but the cannonball is behind the tower and when it shoots down it appears out of the base of the tower. My tower is at a angle not complete top down so that's why it have this problem.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You need to do some Z sorting on your objects, since the view you are describing will have different objects obscuring each other based on how far down the screen they are. I'm making an assumption here, but if your game is based on the top-down 3/4 view (i.e. Zelda 2D games), then you will need to sort by Z.

    The best approach i've seen uses a PV called Z. Every tick your objects set their Z to be equal to their Y, then you loop through all sortable objects based on their Z variable, and send them to back (or bring to front, can't remember now). It might take some fiddling of hotspots and image points to make it work properly, but the basics are all there.

    This will mean that your cannonball will be drawn infront of objects that are further up the screen (i.e. behind), and vice versa. There was an example of this on the forums a couple of weeks ago, try looking for it.

  • I think I got your point, What is a PV by the way?

  • I think I got your point, What is a PV by the way?

    Short for "private variable". You may add a PV using the properties panel. Accessible through events and actions.

  • I understand what you mean, but my object is one sprite, and I want the cannonball to be under the tower top and above the tower bottom. So the only method is to cut the sprite in half.

    Using Zelda as an example. If Zelda is the tower, and he doesn't rotate or move, cannonball will shoot out of his head. The cannonball is under Zelda's head, if the cannonball shoots up, left and right, it would look correct as the cannonball will appears to leave his head. However if it shoots down, the cannonball will appears out of his feet since he is in 3/4 view and the body to his feet is also above the cannonball. So what I am thinking is separate his head and his body, let the cannonball stay under the head and above the body. Or is there another way around this?

    And my other question which is still not answer is if the predictive aiming for the turret works properly?

  • The trick is with the hotspots. You need to offset them to account for the height of the object, from the ground upwards. Your cannon ball is off the ground, but in 3/4 view your hotspot needs to be the centre point of the object on the ground. In this case, you need to shift the hotspot to account for the height of the ball. I'll try to put together an example or tutorial or something later today.

  • Try the Ghost Shooter tutorial at . It covers all these basics such as image points, private variables, etc.

  • Thx GMG, and Ashley I went through all tutorials available including the Ghost Shooter. My other question is still unanswered, does predictive aiming work for the turret behavior? Because I turn it on and it didn't improve the aiming at all.

    I thought the hot spot is the origin of the image? like the point where it rotate around? Not very clear of that.

  • The hotspot is the object's xy position as far as the game engine is concerned. The image of the sprite is drawn relative to the hotspot. So if the hotspot is at (0,0) on a 16*16 sprite, and the sprite is at (100,100) in the game, then it will be drawn in pixels (100,100) to (115,115). If, on the other hand, your hotspot was in the centre, your sprite would be drawn from (92,92) to (107,107), or there abouts.

    You can use this to trick the player into seeing a 2D world that appears 3D. Imagine looking down on your game world from directly above at 12 0'clock, with the shadows of the objects acting as collision masks. If you were to tilt the camera upwards the shadows would appear below the objects and any objects off the ground would appear further from their shadows, but the game would still see the world in terms of the collision masks (i.e. the shadows).

    I think a diagram may explain this far better than mere words, but I've been playing MegaMan 9 all night so I didn't get around to making that example I promised. It's coming, I assure you.

    Can't help with that aiming issue though.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)