Create object at Image Point not working (Android)

Discussion and feedback on Construct 2

Post » Tue Dec 17, 2013 3:58 pm

Hi! I tested my game on PC, iOS 6, iOS 7 and Android 4.4 and I noticed a problem on the android tablet. When a object is created at an image point it sometimes appears half off screen or outside the image and not at the image points. Did anyone else notice something like this? It did not happen on PC or the iOS devices so far.

Here is the code I used:
B
54
S
16
G
6
Posts: 719
Reputation: 9,207

Post » Tue Dec 17, 2013 4:40 pm

You shouldn't expect the function return value to be the same out side the on function event.
Image ImageImage
B
169
S
50
G
169
Posts: 8,287
Reputation: 108,218

Post » Tue Dec 17, 2013 5:12 pm

But it works fine on PC and iOS. I thought the ReturnValue will be accessible outside (got a sample from someone where this worked) and the manual says:
ReturnValue
Return the value set using the Set return value action from the last function call. If Set return value is not used in a function, it returns 0.

So it should be at least always "0" and return the Imagepoint X and Y of point 0 if it is not working properly, and not spawn anywhere on screen where no Image Point is placed at all?Bl4ckSh33p2013-12-17 17:14:07
B
54
S
16
G
6
Posts: 719
Reputation: 9,207

Post » Tue Dec 17, 2013 5:29 pm

You have every random 4 seconds, which is not ideal(should be if random(something) = something else, then do stuff), setting it to -1 all the time.


Also do you see the expression to get the return value for a specific named function?
Image ImageImage
B
169
S
50
G
169
Posts: 8,287
Reputation: 108,218

Post » Tue Dec 17, 2013 5:40 pm

But whats the difference when using "if int(random(x)) = y". It only spawns when the random x is y. Can you explain why this method would be better, please?

Do you mean "call" (Call a function directly from an expression.)?
https://www.scirra.com/manual/149/function


btw:
the collapsed function code:
Bl4ckSh33p2013-12-17 17:40:30
B
54
S
16
G
6
Posts: 719
Reputation: 9,207

Post » Tue Dec 17, 2013 6:19 pm

Every random() seconds doesn't make sense logically since the event is run every tick. So if random = 4 in one tick, and 2 in the next, 2 will come first, out of order.

There is no expression to get a named function's return value, that's the point.

The function object is global, so the return value can be changed by any function call.

Hopefully you can see where that could be an issue down the line.

Also pretty sure that While wont play nice in an event that's only triggered oncenewt2013-12-17 18:35:23
Image ImageImage
B
169
S
50
G
169
Posts: 8,287
Reputation: 108,218


Return to Construct 2 General

Who is online

Users browsing this forum: Baidu [Spider], LaDestitute, MPPlantOfficial, rbailey83 and 29 guests