plat move

For questions about using Classic.

Post » Mon Jun 09, 2008 11:00 pm

ty for all your help
B
2
S
2
G
4
Posts: 259
Reputation: 1,968

Post » Tue Jun 10, 2008 2:46 am

Try this on for size.

[url:18ylf8uu]http://www.filedropper.com/lolfighter[/url:18ylf8uu]

There are a couple problems I don't have time to fix, but at least it will get you started.

Known issues:
-Landing a jump while moving up causes a hang. This is a bug and should be reported.
-I don't know a good way of making a ceiling that doesn't allow creeping.

Have fun!
B
3
S
2
G
4
Posts: 310
Reputation: 2,120

Post » Tue Jun 24, 2008 12:14 am

ty really appreciate it
B
2
S
2
G
4
Posts: 259
Reputation: 1,968

Post » Tue Jun 24, 2008 3:25 am

Allow me to see if I can explain this to your liking. I'm terrible at these things, so let me know if I leave something out...

The detector method here is really only used in a visual sense. In fact, there is only one detector and its sole purpose is to create the base XY of the character sprite. Many 2D games use this to create seamless detection (similarly, SMB1 used 8x8 box math). In modern game engines with advanced collision detection (Contruct's per-pixel) it nearly becomes a necessity as animation frames cause the intended surfaces to constantly change. The character sprite is then placed on top of it and does not affect the world movement collisions. The times when character sprite collision is useful is, say, when the player encounters an enemy or dodges a bullet.

This system is helpful in the type of game you wish to create if only because you wish to add jumping. If your character sprite was the sole arbiter of world collisions, jumping would interact with the world and cause a number of game-breaking troubles. So I give the detector a 4-direction movement, which directly controls its associated character sprite. I then give the character sprite a gimped platform movement to allow jumping. This is what programmers call 'overloading,' but I guess we're using the term rather loosely here.

Which brings us to your first question:
[quote:a8wlgodc]"Sprite[Platform].VectorY equal to 0" Why/Where?[/quote:a8wlgodc]

Because we are using two movement behaviors and forcing one to be directed by the other, we run into a few immediate problems. First, both are controlled by the player's input. Second, the platform movement will forever be "falling" even as it is repositioned each frame. Because all we want the platform movement for is its jumping ability, we must then turn all other functions OFF. This is done not only in the behavior's default variables, but also selectively at run time. And here's why.

We are already always setting the character's X coordinate to the detector's X to mirror its left/right movement. We also need to mirror its Y, but not when jumping. Therefore my solution is to turn the platform movement's gravity on and off.

[code:a8wlgodc]//WHILE THE GRAVITY IS TURNED OFF (player not jumping), MIRROR THE DETECTOR'S VERTICAL MOTION.
System: 0 Sprite[Platform].Gravity Equal to 0
> SpriteSet Y to Detector 0 .Y

//WHEN JUMPING, TURN THE GRAVITY BACK ON.
MouseKeyboard: 7 On "Jump" pressed
> SpriteSet gravity to 1500

//WHEN THE JUMP FINISHES (character sprite comes to a rest on our detector, i.e. its vertical motion [vector Y] equals zero), TURN GRAVITY BACK OFF TO AGAIN HONOR DETECTOR'S VERTICAL MOTION.
System: 0 Sprite[Platform].VectorY Equal to 0
> SpriteSet gravity to 0[/code:a8wlgodc]

As to where this is located, it's in the wizard under the System object. The system object can access any other object's system-level functions via "Compare" and "Evaluate," among others. Please take the time to look over what system-level functions different objects have. It opens up a whole new world as you begin to realize you can create events using mathematical comparisons instead of the visual product on the screen.

Also, it's faster. Sure you could use 15 box objects as detectors, but if you know what purpose those detectors serve you can compare a value mathematically prior to the screen draw instead of after it has already happened. For instance, imagine you keep a detector that always sits 15 pixels to a sprite's right. Instead of "Detector collided with Enemy during previous frame," you could compare it using the system object as "Enemy's X coordinate is equal to (Sprite's X + 15)."

[quote:a8wlgodc]"On "Jump" pressed"[/quote:a8wlgodc]

In the application properties is the default control sheet, where in this case the control named "Jump" is set to the Shift key. In the events, Construct translates the input's given name "Jump" as whatever key it is set to. This is because "Jump" IS a value, and it stands in place for yet another value. You may create any control you wish and you could use its name in your events.

[quote:a8wlgodc]".Height/2"[/quote:a8wlgodc]

This is not something you'd generally be concerned with. I wanted to create a ceiling, but I could not use a solid object. So I force my detector to stay at the bottom of the box object representing the sky. The box object by default places a hotspot in the dead center of itself, so I use a little bit of math to ensure no matter what size you make that box Construct will always know its lowest point and stop the detector from moving past it. It goes as such:

[code:a8wlgodc]The Detector's Y (vertical) coordinate is less than (above, since 0 is at the top of the screen) the Box's hotspot (Y); So, reset Detector's Y to Box's hotspot PLUS (lowered by) half of its height (the remaining distance between the hotspot in the middle and its own bottom edge).[/code:a8wlgodc]

It is a quick and dirty implementation to show the basic concept. I'm sure somebody here can provide a more elegant approach to it.


So, does that help you at all? Did I leave anything out?
B
3
S
2
G
4
Posts: 310
Reputation: 2,120

Post » Tue Jun 24, 2008 10:48 am

Thats well explained Daddy.
B
3
S
2
G
4
Posts: 322
Reputation: 2,119

Post » Tue Jun 24, 2008 11:58 am

ty
B
2
S
2
G
4
Posts: 259
Reputation: 1,968

Post » Tue Jun 24, 2008 3:12 pm

Your time to answer questions will come. Dont hurry. It will be sooner then you think now. Just keep asking. And realize that you are asking our questions and those from people that did't make a "log in name".
B
3
S
2
G
4
Posts: 322
Reputation: 2,119

Post » Tue Jun 24, 2008 3:14 pm

I understand where this confusion is coming from. The application properties, among other things, does seem kinda hidden away now that I think about it. At least compared to MMF where most things are menu-driven, Construct may be a little daunting at first as it often requires the user physically navigate to an option whilst not providing a traditional means of finding it (This has been my complaint about "Ribbon" systems also seen in Office products recently).

I guess the best advice I can give is don't be afraid to explore. :)
B
3
S
2
G
4
Posts: 310
Reputation: 2,120

Post » Wed Jun 25, 2008 6:59 am

[quote="CaptainOblivious":uc6pp4tl]compared to MMF where most things are menu-driven, Construct may be a little daunting at first as it often requires the user physically navigate to an option whilst not providing a traditional means of finding it (This has been my complaint about "Ribbon" systems also seen in Office products recently).[/quote:uc6pp4tl]
As far as I can tell, the "ribbon" pretty much is a menu (with illustrations). Now if only it knew to get out of the way when you're not using it, and supported [Alt]+[letter] keyboard navigation ...
B
2
S
1
G
4
Posts: 60
Reputation: 1,320

Post » Wed Jun 25, 2008 12:46 pm

Drop down menu just 2 pixels on the left of the home menu.
Minimize ribbon.
B
3
S
2
G
4
Posts: 322
Reputation: 2,119

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests