(Suggestion) other expression

Discussion and feedback on Construct 2

Post » Sun Oct 25, 2015 11:36 pm

I was wondering if you guys can add an other expression

this would return the other instance of an event if there is one
it would cut down code a ton and would be just plain simpler to use

for example in a collision event you could make a damage function do
accelerate towards angle (self.X, self.Y, other.X, other.Y)

this way you only need to use one parameter for the knockback strength instead
having to include 2 other parameters for the angle

and keep in mind this would just be something I would do with it

it could be a major short cut for everybody
and would be extremely useful
B
13
S
6
G
1
Posts: 149
Reputation: 1,960

Post » Mon Oct 26, 2015 12:34 pm

I'm not sure exactly what the "other" expression would refer to. In your description it seems to be defined as "a magic expression that does what I want". What exactly would it refer to? There are a great many "other instances" it could potentially refer to, how should the engine pick which one you mean? Also in your example "Self" and "Other" are used as object type names, which are not object instances.
Scirra Founder
B
387
S
230
G
87
Posts: 24,249
Reputation: 192,240

Post » Mon Oct 26, 2015 1:36 pm

Shadowblitz16 wrote:I was wondering if you guys can add an other expression

this would return the other instance of an event if there is one
it would cut down code a ton and would be just plain simpler to use

for example in a collision event you could make a damage function do
accelerate towards angle (self.X, self.Y, other.X, other.Y)

this way you only need to use one parameter for the knockback strength instead
having to include 2 other parameters for the angle

and keep in mind this would just be something I would do with it

it could be a major short cut for everybody
and would be extremely useful


Solution is to make a family, which include all *other* objects, pick nearest *other* and do the angle()
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
85
S
27
G
21
Posts: 1,966
Reputation: 19,159

Post » Tue Oct 27, 2015 1:36 am

Ashley wrote:I'm not sure exactly what the "other" expression would refer to. In your description it seems to be defined as "a magic expression that does what I want". What exactly would it refer to? There are a great many "other instances" it could potentially refer to, how should the engine pick which one you mean? Also in your example "Self" and "Other" are used as object type names, which are not object instances.


sorry it would return the other instance of a condition not a event

like for say if placed inside a (is overlapping event) or a (on collision of another object) condition it would return the object it would return the object chosen in that event

however if it was placed in a event like (is between angles)
it would normal return (null ,nil, -1)
however if it was placed in a (is between angles) in a (is overlapping event) or a (on collision of another object) condition it would return the object it would return the object chosen in the collision event

basicly it would return the other instance in a condition if there was one
else would return a null value or -1
B
13
S
6
G
1
Posts: 149
Reputation: 1,960

Post » Tue Oct 27, 2015 2:54 am

If I understand what you mean, what you ask is already there:
Image
This will pick all instances that meet both the first AND second condition.

Image
This will pick all instances that meet either the first OR the second condition.

Right click and select "Make Or block"
B
13
S
5
G
1
Posts: 116
Reputation: 1,805

Post » Tue Oct 27, 2015 3:40 am

@immortalx

I want to get the direction of the collision of the other object
which in your case is blue
not myself

and I can't perform any arithmetic functions on it because I can't return the other object inside the condition statement

this is going to be inside a function called when the two sprites collide
B
13
S
6
G
1
Posts: 149
Reputation: 1,960

Post » Tue Oct 27, 2015 5:22 am

@Shadowblitz16

I feel terribly sorry for not understanding what you mean (English is not my native language).
Can you post a capx just to make sure we both talk about the same thing?
B
13
S
5
G
1
Posts: 116
Reputation: 1,805

Post » Tue Oct 27, 2015 11:54 am

What if there are 5 other conditions in the event which all refer to different object types? What if there are hundreds of "other" instances to choose from? How do you know which will be referred to by "other"? This seems far too ambiguous to be useful at all.
Scirra Founder
B
387
S
230
G
87
Posts: 24,249
Reputation: 192,240

Post » Tue Oct 27, 2015 5:29 pm

What's wrong with using families ?
B
47
S
16
G
9
Posts: 1,097
Reputation: 11,180

Post » Tue Oct 27, 2015 6:20 pm

@Ashley it could be done in the order of conditions.
for example other(0) - other(4) for 5 conditions that refer to the other object

Edited @spongehammer this is why
I want to do something like

function knockbackEntity(strength)
set acceleration
(functionParam(0))
(other(0).X,other(0).Y,self.X,self.Y)

I don't see how to do this with familys that allows it to be this customizable
Last edited by Shadowblitz16 on Tue Oct 27, 2015 7:03 pm, edited 3 times in total.
B
13
S
6
G
1
Posts: 149
Reputation: 1,960

Next

Return to Construct 2 General

Who is online

Users browsing this forum: R0J0hound and 9 guests