Powered by Invision Power Board

 
    Reply to this topicStart new topicStart Poll

> GM6: A variable is refusing to change, EDIT: Solved
Unspecified
Gorgoo
Posted: Jun 30 2007, 02:37 PM
Quote Post


Standard Member


Group Icon
Group: Members
Posts: 70
Member No.: 558
Joined: 16-August 04

Status: (0d) [--]


EDIT: Sorry about creating a topic. I solved the problem soon after posting this.

In the game I'm creating, at one point I assign a number (either 1 or 0) to a variable called dir, which decides the direction that an enemy moves in. There are invisible sensors that, when the enemy runs into, change the variable dir from 1 to 0, or vice versa.

At least, that's how it was planned. The code is below, and for some reason, dir doesn't seem to be changing at all.

CODE
Collision Event with object obj_turnsensor:
execute code:

if dir = 1 then
{
dir = 0
x -= 12
}


The x value is changing visibly, so that code seems to work. It's not an inherent problem with the "dir" variable, though, because at another point in the code, I have it change from 0 to 1 without a problem.

CODE
//This works:
if dir = 0 then
{
dir = 1
x += 12
}


In the segment of code that doesn't work, replacing "dir" with another variable also doesn't result in it changing, so it might be something wrong with the way I'm assigning the variable, but I don't see a problem.

Does anyone know what could be wrong with this?

This post has been edited by Gorgoo on Jun 30 2007, 03:01 PM
PMEmail Poster
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

  Topic Options Topic Options Reply to this topicStart new topicStart Poll

 




[ Script Execution time: 0.0349 ]   [ 14 queries used ]   [ GZIP Enabled ]   [ Server Load: 1.09 ]