A few questions

For questions about using Classic.

Post » Sun Feb 21, 2010 8:03 am

Hi,
Before I start, I'd like to say that I love Construct so far, it seems great. I'm making a small game to get used to using it, but I'm having a few problems:

-Firstly, is there a way to change the 'facing' for an object, without rotating the object itself. For instance, I'm making a shooter, and when bullets are spawned they move in the direction of the facing. However, it seems that the facing defaults to the right, and I want them facing up. I worked around it by drawing up all my sprites facing to the right and then rotating them in construct, but I was just wondering if there was an easier way around this that I was missing.

-Secondly, the wrap behaviour doesn't seem to be working for me. It wraps both vertically and horizontally, even when I only have horizontally ticked. Also, is there a way for me to block moving off the edges at all, instead of wrapping or just going on forever?

-Lastly, I'm having trouble using the else function. When you destroy a rock, there's a random chance that a powerup will show up. Then, there's a random chance that it will be such-and-such powerup, and then there's a random chance that it will be this powerup, or that one. Or at least, that's what's meant to happen, but I can't get it to work.

Her's the .cap in case you want to look at it.
(I changed some variables so that the powerups will appear every time, so that I can test it better)
[url:n4hjohpf]http://dl.dropbox.com/u/4649219/SpaceGameTest.cap[/url:n4hjohpf]
B
3
G
2
Posts: 5
Reputation: 685

Post » Sun Feb 21, 2010 8:56 am

[quote="Fondis":1ierckm0]-Firstly, is there a way to change the 'facing' for an object, without rotating the object itself. For instance, I'm making a shooter, and when bullets are spawned they move in the direction of the facing. However, it seems that the facing defaults to the right, and I want them facing up. I worked around it by drawing up all my sprites facing to the right and then rotating them in construct, but I was just wondering if there was an easier way around this that I was missing.[/quote:1ierckm0]

Yeah, have the same thing going on here since I'm also sort-of making a vertical shmup - always turning the art 90 degrees counterclockwise is a bummer, but I'm almost used to it. Maybe someone will give a solution, who knows.

[quote="Fondis":1ierckm0]-Secondly, the wrap behaviour doesn't seem to be working for me. It wraps both vertically and horizontally, even when I only have horizontally ticked. Also, is there a way for me to block moving off the edges at all, instead of wrapping or just going on forever?[/quote:1ierckm0]

At first I thought about the old fashioned way of doing this with an "If Ship.X > PlayAreaWidth" etc, but then realized it's not really necessary, this is easier and faster:

[code:1ierckm0]+ System: Always (every tick)
-> Player: Set X to clamp(Player.X,40,600)[/code:1ierckm0]
Clamp is a great function - it basically limits the value to whatever you want - in this case it's a minimum of 40 and a maximum of 600 pixels so your ship stops a little before the outer edge. Do the same for Y and you are set.

[quote="Fondis":1ierckm0]-Lastly, I'm having trouble using the else function. When you destroy a rock, there's a random chance that a powerup will show up. Then, there's a random chance that it will be such-and-such powerup, and then there's a random chance that it will be this powerup, or that one. Or at least, that's what's meant to happen, but I can't get it to work. [/quote:1ierckm0]

I'd say don't try to do this with a lot of ELSEs - try just setting some variable to a random value and then do checks on that.

I'm being a little vague here to inspire learning, heh, heh :)

P.S. Look into using groups in your cap - really helps hold it all together and have a clearer overview of what's going on.
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Sun Feb 21, 2010 11:08 am

Thanks for the reply,
I can see that the clamp function will be really useful, and it works exactly as I had hoped. As for the else, it seems like that isn't the problem at all. One of the powerups just won't show up, even when I place it directly on the layout. I'll keep looking around, it's probably just something small that I'm missing.

-Edit-
I found and fixed the problem, it's not as clean as I'd like, but it works. So that's all of my questions answered, so thanks for the help.
B
3
G
2
Posts: 5
Reputation: 685

Post » Sun Feb 21, 2010 2:18 pm

[quote="Fondis":21paj5fq]So that's all of my questions answered, so thanks for the help.[/quote:21paj5fq]

Slow your roll there, buddy. We got some things to talk about first.

[quote="Fondis":21paj5fq]-Firstly, is there a way to change the 'facing' for an object, without rotating the object itself. For instance, I'm making a shooter, and when bullets are spawned they move in the direction of the facing. However, it seems that the facing defaults to the right, and I want them facing up. I worked around it by drawing up all my sprites facing to the right and then rotating them in construct, but I was just wondering if there was an easier way around this that I was missing.[/quote:21paj5fq]

[quote="Somebody":21paj5fq]Yeah, have the same thing going on here since I'm also sort-of making a vertical shmup - always turning the art 90 degrees counterclockwise is a bummer, but I'm almost used to it. Maybe someone will give a solution, who knows.[/quote:21paj5fq]

If you guys mean you want your bullets always facing up then you can draw them facing up and set the Rotation property in the sidebar to "No rotation."

[quote="Fondis":21paj5fq]-Lastly, I'm having trouble using the else function. When you destroy a rock, there's a random chance that a powerup will show up. Then, there's a random chance that it will be such-and-such powerup, and then there's a random chance that it will be this powerup, or that one. Or at least, that's what's meant to happen, but I can't get it to work. [/quote:21paj5fq]

Okay, first off you don't need a bunch of "0 = 0" events laying around. It's a useless event. All it's doing is basically saying "True" every tick, which is what the Always event does. Get rid of them.

Next, the reason your blue objects aren't showing up is because you're using Else incorrectly. But more on that in a moment. Let's have a look at a more stable spawning event. This is how you were doing it:



You have two separate events checking two separate random numbers. Unless you mean for both powerups to spawn at once on occasion (which I guarantee they were, you just couldn't see them) then you need to roll the dice just once, so to speak. Set yourself up another variable to hold your random and check it in a condition, like so:



Now it will only generate one at a time.

Now, about that Else. See, even though the blue powerup was being spawned, the way you had your Else set up it was basically being destroyed immediately in the same tick. Else isn't supposed to be used as a sub-event. It's a special event that you place immediately after the event you want to else. Like so:



Notice it makes a little pipe connection to the previous event. That's how you know it's working.

Also, you can't Else a trigger event like "On collision." Those events happen in just one tick, so saying Else to them is like saying "Every time it's NOT colliding," which kind of defeats the purpose here. Hence the reorganization of the sub-events. Works fine.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sun Feb 21, 2010 5:48 pm

[quote="deadeye":2qwni4mz]If you guys mean you want your bullets always facing up then you can draw them facing up and set the Rotation property in the sidebar to "No rotation."[/quote:2qwni4mz]

Ok, I got hired by a shady government agency to create the most unnecessary explanation illustration ever, here's the first attempt:



The thing is - the default angle happens to be sideways to the right. It's geometrically correct, it's great for a platformer, BUT... what if your entire game takes place while moving up? Of course you design your sprites for such a viewpoint, you do the design mockups like that, you THINK vertically. Then you insert the graphics and get to do a 90 degree counterclockwise turn for pretty much everything.

That or design sideways...



Edit: Yeah, forgot my point somewhere there... it would be AWESOME to be able to set the "world direction" for a given layout (even in 90 degree increments). Would make life so much easier for shmupmakers.
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Sun Feb 21, 2010 8:56 pm

Okay you made your point :lol:

Yes, you would still have to set the angle in events to make the bullets fire upward with Bullet behavior. My bad.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Mon Feb 22, 2010 5:16 am

Wow, the amount of help on the forums is great.

That comment about the else was spot on, same about using the random. As for the is 0 = 0, that was intended to run every time, so that I wouldn't have to wonder if the powerups weren't spawning or if I was just unlucky. It was originally is random(9) = 0.

Regardless, I think I can confidently say that everything's working fine now, so thanks again to both of you.
B
3
G
2
Posts: 5
Reputation: 685

Post » Mon Feb 22, 2010 7:43 am

[quote="Fondis":1mtg2v7u]Wow, the amount of help on the forums is great.[/quote:1mtg2v7u]

Just be sure to pass it on when you've got more experience :).
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests