new to C2, got a minor question and a critical one

Get help using Construct 2

Post » Thu Feb 06, 2014 5:50 am

First the easy part:

1) How do I make an object bounce from the player sprite a short distance? I have programmed a bullrush move, and I want enemies to bounce off of him. This works fine if I add the bullet behavior to the enemy, and the enemy speed is >0, but if I want still objects (speed=0) to bounce, the bullet behavior doesn't work at all. Move at an angle is way too abrupt and is more like a teleport.


Here is the kicker:

2) This answer will determine whether or not I purchase this program. How efficient is the coding? I am using the free version, obviously, and I have started scripting out a very complicated game. I am close to the 100 event limit, and the player has over 50 instance variables and 50 frames of placeholder animations (colored squares essentially), and there are 30-ish objects on screen. No physics have been enabled. When I run it on IE and my friend runs it on Firefox, if I double the movement speed of the character and zoom around for about 15 seconds, the layout throws up out of memory errors and crashes. If IE crashes, I'm not really that surprised, but I really can't tolerate a game that can't run on Firefox. How many "lines of code" can C2 support before it becomes a lagfest?

Thanks!
B
4
S
1
Posts: 18
Reputation: 388

Post » Thu Feb 06, 2014 7:37 am

When you say you want objects to "bounce" even if their speed = 0, this surely implies there is a collision and if there's a collision it's extremely easy to use the collision trigger to achieve what you want.

You're basically going to need to use the On collision to trigger "set bullet speed"&"set bullet angle of motion" actions on the inert object.


Secondly in my experience C2 can handle far more code than you could possibly throw at it with the free version, crashing after 5 secs implies to me you've either got a recursive loop kicking in or your code is continually spawning objects. Does it go out of memory if you do nothing or is it only if you move? Have you tried debugging it to see where the resources are being used?
There are 10 types of people in the World, those that understand binary and those who don't.
B
7
S
2
Posts: 93
Reputation: 797

Post » Thu Feb 06, 2014 12:03 pm

For the second one.. Please upload your example .capx to somewhere to be seen (like dropbox). It's nearly impossible to comment without seeing the original problem. Especially if there's some mistake (or logic fault) at the event code, it's mandatory to see the files and be able to run them on one's own PC.


Need help? Upload .capx file with your question.
B
16
S
4
G
2
Posts: 233
Reputation: 2,560

Post » Thu Feb 06, 2014 3:49 pm

[QUOTE=Bertie Booster] When you say you want objects to "bounce" even if their speed = 0, this surely implies there is a collision and if there's a collision it's extremely easy to use the collision trigger to achieve what you want.

You're basically going to need to use the On collision to trigger "set bullet speed"&"set bullet angle of motion" actions on the inert object.


Secondly in my experience C2 can handle far more code than you could possibly throw at it with the free version, crashing after 5 secs implies to me you've either got a recursive loop kicking in or your code is continually spawning objects. Does it go out of memory if you do nothing or is it only if you move? Have you tried debugging it to see where the resources are being used? [/QUOTE]


1) I set the player to solid temporarily, set its speed. Then I made the motionless object a bullet, set it to bounce off solids, and set its speed to zero. I run into the object and pass right through it. If I set the bullet angle and speed, won't it fly off into oblivion? I was hoping for it to bounce a distance, slow down, and then stop.

2) Thank you, that is what I was hoping for. I am planning for several thousand "lines of code." I was worried that a web game would not be able to support it.


[QUOTE=Joannak] For the second one.. Please upload your example .capx to somewhere to be seen (like dropbox). It's nearly impossible to comment without seeing the original problem. Especially if there's some mistake (or logic fault) at the event code, it's mandatory to see the files and be able to run them on one's own PC.[/QUOTE]

Thank you for offering to look at it! I don' have permission to share links, so please insert and replace what's necessary .

//dropbox link/s/a026ni9nf1nu06q/construct_test.
B
4
S
1
Posts: 18
Reputation: 388

Post » Thu Feb 06, 2014 5:06 pm

Perhaps you should try a few of the beginner tutorials before getting too deep into things.

There are a few telltale things you haven't thought about such as "50 frames of animation", and "several thousand lines of code".

That's not going to work on any platform.
You can't just pile things on and hope for the best.
Image ImageImage
B
172
S
50
G
183
Posts: 8,440
Reputation: 115,599

Post » Thu Feb 06, 2014 5:13 pm

Whoops, I accidentally deleted the file. Here is a new link. Again, please insert the dropbox com address:

/s/cxnd6qk9g054081/construct_test.capx
B
4
S
1
Posts: 18
Reputation: 388

Post » Thu Feb 06, 2014 5:20 pm

[QUOTE=newt] Perhaps you should try a few of the beginner tutorials before getting too deep into things.

There are a few telltale things you haven't thought about such as "50 frames of animation", and "several thousand lines of code".

That's not going to work on any platform.
You can't just pile things on and hope for the best.[/QUOTE]

I'm not sure what you mean. Are you suggesting Super Ubie Land doesn't have more than 50 frames of animation in the entire game? Or at least several hundred lines of code? I'm also not sure how a beginner's tutorial would show me how to program efficiently.
B
4
S
1
Posts: 18
Reputation: 388

Post » Thu Feb 06, 2014 5:34 pm

I see a whole lot of inefficient programming, repeating the same conditions.

For instance:

The last three events all start with for each damagesource. Wouldn't it be easier to combine these?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Feb 06, 2014 6:01 pm

The question isn't if that can be done, obviously it can.
Just saying you may not be up to that level yet.

Find the bugs, fix them.

Id suggest starting with the "for each" running every tick.
Image ImageImage
B
172
S
50
G
183
Posts: 8,440
Reputation: 115,599

Post » Thu Feb 06, 2014 6:06 pm

Thanks for the help! Aside from inefficiencies, which will need to be cleaned up later, I'm looking for memory leaks and sources of crashes.

For instance, I have the opacity set to 100 whenever isCloaked is false, and set it to 50 when isCloaked is true. I know that is a bunch of actions that don't need to happen if I just set the opacity to every time it is toggled rather than running all the time. Will things like that crash my program?
B
4
S
1
Posts: 18
Reputation: 388

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 6 guests