Platforming game help

For questions about using Classic.

Post » Sat Dec 06, 2008 3:08 am

G'Day. With my WIP platformer, I have a few problems... Okay, four.

Here's the cap file.
This topic has more details on what I'm working on, as well as controls and stuff.

- Firstly, going between rooms. Each "exit" uses the "Doorside" variable, which switches between 1 and 0, depending on which side of the door the character is supposed to be on. However, going through the first door, which is supposed to change the 0 to a 1, doesn't change it, rendering all the other doors unusable. I'm stumped as to why.

- The "test" room has a WIP pause menu that works by pressing "P", which drops TimeScale to 0 and makes the menu pop up, and when the button is pressed again, it goes back to normal. When I press P, nothing happens.

- Julius, the most "complete" character, has a slide move. It works, but his animation quickly goes back to crouching mid-slide.

- As well, Julius, when he is supposed to attack, only does so when I'm screwing around, jumping and stuff. As for the attack itself, I realise the way the whip spawns isn't very good. Anyone got any suggestions for a better method?
B
94
S
37
G
11
Posts: 404
Reputation: 11,275

Post » Sat Dec 06, 2008 5:42 am

Here's what's wrong with the pause:



The first event activates when you hit P, and changes the Pause variable to 1.

Then it moves on to the next event. Since the Pause variable is now 1, it triggers this event too, which changes Pause to 0. So you're pausing and then immediately unpausing again in the same tick, so you never see it. You need a toggle in there:



The toggle always resets to 0 before it checks your On Key events. When your On Key event is reached, it makes sure that pauseToggle is 0 before performing the action. If it is 0, it will change to 1. That way when it reaches the next event, it won't trigger.

I'll take a look at the other stuff really quick, but just a heads up I can't seem to play your game. I don't know what's up, but nothing moves.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sat Dec 06, 2008 5:46 am

One thing... you have fifteen Start of Layout events in your test layout alone. You only need one. You should really learn to use sub events.

Edit:
In fact, I can see a lot of common mistakes in general in your .cap. You have your animated sprites as your Platform objects, and you have them set to Per Pixel collision. This is just going to cause problems for you. You should make a separate, invisible box and use that as your platforming object, and just position your sprites on top of it.

You don't need to do this for every kind of game, but the way the platform object works you're just going to run into trouble.

Plus, you would only need one platforming object, and you can use it to put your different character sprites on. If they have to have different speed or jump heights or whatever, you can change those at runtime depending on what character is selected.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sat Dec 06, 2008 6:00 am

... Wow, I hadn't thought of that, that was the same sort of thing that stopped my cutscene from working with just one button press... And sub-events, gotcha.

Regarding the platform stuff: Huh, I never thought of that. I guess I'll take your word for it, then... I'm a complete beginner, so I expected to make mistakes.

Edit: Curses, same technique doesn't work for the cutscene. Shame.
B
94
S
37
G
11
Posts: 404
Reputation: 11,275

Post » Sat Dec 06, 2008 5:44 pm

[quote="deadeye":3qvnbj5z]
You don't need to do this for every kind of game, but the way the platform object works you're just going to run into trouble.[/quote:3qvnbj5z]

It's generally good practice to create invisible hitboxes for most sprites anyway as oppose to pixel perfect collision I think. I think it's a fairly common practice but I usually draw my backgrounds seperately in photoshop and then after importing the image, build the platforms using hitboxes also, which makes the whole thing run a lot smoother.
B
2
G
4
Posts: 22
Reputation: 1,094

Post » Sat Dec 06, 2008 7:30 pm

A better way to handle pause is to use the ELSE condition and a subevent. Eg:

+ On P pressed
----+ (conditions saying it's already paused)
----> Unpause

----+ Else
----> Pause

This way you don't need any flags or other events (and it's easier to make sense of too).
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Sat Dec 06, 2008 8:00 pm

[quote="i stole your car":d2xnakmp][quote="deadeye":d2xnakmp]
You don't need to do this for every kind of game, but the way the platform object works you're just going to run into trouble.[/quote:d2xnakmp]

It's generally good practice to create invisible hitboxes for most sprites anyway as oppose to pixel perfect collision I think. I think it's a fairly common practice but I usually draw my backgrounds seperately in photoshop and then after importing the image, build the platforms using hitboxes also, which makes the whole thing run a lot smoother.[/quote:d2xnakmp]

True, but it's not exactly best for all games. Like a top-down space shooter for instance, where you don't really have walls or solid objects. Bullets hitting your ship would work better with Per Pixel in that case. Especially if your ship has an odd, angular shape (which most tend to do).

[quote="Ashley":d2xnakmp]A better way to handle pause is to use the ELSE condition and a subevent. Eg:

+ On P pressed
----+ (conditions saying it's already paused)
----> Unpause

----+ Else
----> Pause

This way you don't need any flags or other events (and it's easier to make sense of too).[/quote:d2xnakmp]

Ah, that is better. I remember someone posting an alternative to my method before but I couldn't recall what it was.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Mon Dec 08, 2008 1:13 am

Well I'll be darned, it works, and it solved the cutscene problem too! Thanks.
B
94
S
37
G
11
Posts: 404
Reputation: 11,275

Post » Thu Dec 11, 2008 11:08 am

Alright, with my new version of my game, I have run into some new problems. The pause problem is now gone, the other problems, on the other hand, have yet to be fixed. Also, a major new problem has come up.

Whenever the character goes into a room OTHER than the first room (from debug tests, this seems to occur in every room besides the "test" room), the character reverts to Julius, and falls through the floor. This is a curious thing, and despite my examining of the events, the source of the problem eludes me. Anyone got any clue?

.cap file
B
94
S
37
G
11
Posts: 404
Reputation: 11,275

Post » Fri Dec 12, 2008 7:21 pm

That cap only has one layout, the one where you pick your character lol
Do you have the sprite that indicates the player selected set on global?
B
13
S
3
G
5
Posts: 286
Reputation: 3,193

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 6 guests