How to make falling blocks

For questions about using Classic.

Post » Wed Dec 03, 2008 9:50 pm

Alright, as easy as it sounds, I haven't been able to do it yet.

The best example would be the falling blocks in Mega Man 2, Bubble Man's level.
You jump on the block, it falls, and reappears after a few seconds.

The major problems I'm having is:
1. When making the block a solid, the event does not execute. When unsolid, it works fine (but it needs to be solid! lol)

2. The re-spawning of blocks doesn't work correctly.

Here is a quick re-creation of my prob
[url:1am9ps2a]http://www.fileden.com/files/2008/3/4/1796632/fallblock.cap[/url:1am9ps2a]
B
13
S
3
G
5
Posts: 286
Reputation: 3,193

Post » Fri Dec 05, 2008 3:00 am

I think the problem may be how fast you have them falling. You have it so that As soon as you collied with the object it makes it fall. Try adding a timer.

So it could be like

[code:52jkw4qn]
On Collision with Block and Platform
+ Set Variable falling to 1.

Platform variable = 1
Every 1000 Millisecond
add 1 to variable Timer.

Timer greater than Strength
Fall block set y = y-2
[/code:52jkw4qn]

Edit*
so you would need to add private variables for strength and Timer...


Now for the respawn:
The original problem was you had the platforms spawning at themselves.
So here is a bit of code that I think will have the desired effect.

[code:52jkw4qn]
+Every 2000 Milliseconds

+ Platform does not overlap Placer
>Placer set Overlapped to 0
+ Placer: 'Overlapped' Equal to 0
> SystemCreate object Fallblock 0 on layer 1 at (0, 0) from Placer 1 's pivot point
> PlacerSet 'Overlapped' to 1

[/code:52jkw4qn]

The two other events are sub events and Overlapped is a Private variable in the Placer object. This lets construct know which one to pick. Hope this helped I have a cap with the respawn done but I gave you all the code if you want to see it I can upload it later. Hope it all works out. :D



*Edit Again

To make the block fall right that is the code except Make another collision object without the solid box checked on. And set it so that it always sets it to player.x and player.y+ any amount that puts it where his feet would be. Set that object so that when it overlaps it set the timer to go off.
B
5
S
2
G
4
Posts: 632
Reputation: 2,829

Post » Fri Dec 05, 2008 3:27 am

Thank you thank you thank you Mr. Aeal dude!!! :mrgreen:
I'm going to try it out tomorrow!
B
13
S
3
G
5
Posts: 286
Reputation: 3,193

Post » Fri Dec 05, 2008 6:54 pm

Would you mind i f I used this in my game if we find a need for it ( just the code).
B
5
S
2
G
4
Posts: 632
Reputation: 2,829

Post » Sat Dec 06, 2008 10:08 pm

NO WAY DUDE THAT;S LIKE COPYRIGHT INFRINGEMENT WTFORK OMGio;ferijfesroj;eosrgjse!!!111!1
j/k
its cool lol why would i mind?
B
13
S
3
G
5
Posts: 286
Reputation: 3,193

Post » Sat Dec 06, 2008 11:49 pm

[quote="midnight":2y4pmp5y]NO WAY DUDE THAT;S LIKE COPYRIGHT INFRINGEMENT WTFORK OMGio;ferijfesroj;eosrgjse!!!111!1
j/k
its cool lol why would i mind?[/quote:2y4pmp5y]

You would be surprised... There are some who would just though id check
B
5
S
2
G
4
Posts: 632
Reputation: 2,829


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests