# Two Newb questions

### » Wed Sep 30, 2009 5:53 am

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.
B
1
G
3
Posts: 5
Reputation: 835

### » Wed Sep 30, 2009 6:00 am

use image points for spawning the cannonball, helps with what ur experiencing
B
2
G
3
Posts: 33
Reputation: 916

### » Wed Sep 30, 2009 8:33 am

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.
B
1
G
3
Posts: 5
Reputation: 835

### » Wed Sep 30, 2009 8:58 am

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.
B
2
S
2
G
3
Posts: 105
Reputation: 1,510

### » Wed Sep 30, 2009 7:09 pm

I think I got your point, What is a PV by the way?
B
1
G
3
Posts: 5
Reputation: 835

### » Wed Sep 30, 2009 8:19 pm

[quote="shadowofamn1":1dv48j5z]I think I got your point, What is a PV by the way?[/quote:1dv48j5z]
Short for "private variable". You may add a PV using the properties panel. Accessible through events and actions.
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

### » Wed Sep 30, 2009 9:23 pm

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?
B
1
G
3
Posts: 5
Reputation: 835

### » Thu Oct 01, 2009 8:52 am

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.
B
2
S
2
G
3
Posts: 105
Reputation: 1,510

### » Thu Oct 01, 2009 4:52 pm

Try the Ghost Shooter tutorial at www.scirra.com/tutorials. It covers all these basics such as image points, private variables, etc.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,554

### » Thu Oct 01, 2009 6:41 pm

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.
B
1
G
3
Posts: 5
Reputation: 835

Next