#issue with creating objects

52 messages · Page 1 of 1 (latest)

stiff trench
#

When the player collides with the spike, it is supposed to go to the starting position (works) and create 10 objects which work like particles.

The problem is that when i do, this error pops up. I have no idea what ive done wrong and I need help.

#

This is what happens when the player collides with the spike

#

The spike itself has no code.

#

Sorry for crappy photos i dont want to screenshot all of this, it is quicker to use my phone. Also i will not be switching to the built in particle system because i have no clue how to use it and it doesnt fit how my game is gonna look

nova eagle
# stiff trench

are you using an actual sequence? a sequence is a specific type of asset in gamemaker, it is not referring to a sequence of events or animation

stiff trench
#

Using it where?

nova eagle
# stiff trench

the very first thing here is "set position of sequ", which I'm guessing is sequence

#

the error also references layer_sequence_x

stiff trench
#

Dunno what that means

nova eagle
#

well thats why I'm asking if you're actually using a sequence asset or not

#

because if not, you're using the wrong thing

stiff trench
#

Its an object

nova eagle
#

then thats the wrong thing to use, you should not be using set sequence position

stiff trench
#

What should i do

#

Oh hold on

#

Create sequence?

nova eagle
#

no, you are not using sequences at all, as mentioned they are a specific asset in gamemaker

#

you would know if you made a sequence

stiff trench
#

Ok, dont use sequences

#

So what do i do instead

nova eagle
#

can't really say, you'd have to explain what it is you're trying to do with this bit of code that you're using incorrectly to better help

stiff trench
#

It says deathParticle.variable isnt set

#

What does that mean

#

I changed it a little bit

nova eagle
#

thats unrelated because deathparticle is not a sequence

stiff trench
#

Got rid of the sequence stuff and did this

#

Sorry for blurry photo

nova eagle
#

that would make a bit more sense, but only if PlayerX and PlayerY have been set with actual values before

stiff trench
#

They are

nova eagle
#

otherwise you'll get more not set before reading errors

#

well then try it and see what happens

stiff trench
#

This is code inside the player that happens every step

#

WAIT I THINK IK WHAT I DID WRONG

#

i didnt make it global

#

Now this happens

#

I didnt make playerX/Y global yet

nova eagle
#

variable has not been set with a default value

stiff trench
#

The only variable inside the particle is the duration

nova eagle
#

look at the error; it specifically says this is at fault:

if (variable < 1)
#

that means variable has not been set with a default value in create, or anywhere

stiff trench
#

omg

#

i didnt even see that

nova eagle
#

if you don't set and initialize variables, gamemaker does not know what they are to do things with them

stiff trench
#

Ok wait its fixed now

nova eagle
#

essentially you're doing:

if (undefined < 1)

which would crash

stiff trench
#

Yeah ik

#

I forgot to put down the variable

#

It works now

#

Thank you