Code Error

Posted by DSDownload on May 7, 2008, 7:01 p.m.

Ok, so I was experimenting with a sword slasher game, and I have this problem. The code is fine, but nothing happens.

Here it is:

—–

Key Press 'X'

—–

if image_index = 0

instance_create(x,y,obj_blockmask) with sprite_index = spr_blockmaskup

hspeed = 0;

if image_index = 1

instance_create(x,y,obj_blockmask) with sprite_index = spr_blockmaskdown

hspeed = 0;

if image_index = 2

instance_create(x,y,obj_blockmask) with sprite_index = spr_blockmaskleft

hspeed = 0;

if image_index = 3

instance_create(x,y,obj_blockmask) with sprite_index = spr_blockmaskright

hspeed = 0;

—–

And basically whats supposed to happen, is, if the image index = 0, which is the guy facing up, it'll instance create obj_block mask, which is used to test if the enemy is in collision with the sword, and if it will receive damage. The sprite_index is just what it is, the sprite, hspeed so the character doesnt move while blocking.

If you could please help me fix this thatd be great.

-DSDownload

—–

Not all sayings are worth listening to

P.S. (I didnt want to triple post) I fixed everything, thanks kenon

Comments

SteveKB 16 years, 6 months ago

Press delete then the next loaded page will contain your deleted comment which you can edit or abandon.

Excalibur333 16 years, 6 months ago

I don't know if anywon has answerd you yet of if you have figured it out but when checking the image index you have to round.

if(round(image_index) = 1)

{

}

like that.

DSDownload 16 years, 6 months ago

I fixed it thanks to kenon, and AG, Sometimes 64D is faster, that's why I got the answer here, not at GMC.