Powered by Invision Power Board

 
    Reply to this topicStart new topicStart Poll

> Help with pushing blocks
Belarus
Ndsfreak
Posted: Sep 6 2007, 09:08 PM
Quote Post


Who wants a body massage?
[*][*][*][*]

Group Icon
Group: Members
Posts: 1993
Member No.: 2868
Joined: 28-October 06

Status: (0d) [--]


Here is the code.
CODE
{
 if place_meeting(bbox_left-1,y,obj_block_solid) {exit;}
 rneighboor=noone;
 lneighboor=instance_position(bbox_left-1,y+16,box);
 if lneighboor=noone {x-=4; image_single=0;}
 else {if lneighboor.lmove {lneighboor.x-=4; x-=4; image_single=1;
 if place_meeting(bbox_left-1,y,obj_block_jumpthrough) {exit;}
 rneighboor=noone;
 lneighboor=instance_position(bbox_left-1,y+16,box);
 if lneighboor=noone {x-=4; image_single=0;}
 else {if lneighboor.lmove {lneighboor.x-=4; x-=4; image_single=1;
 if place_meeting(bbox_left-1,y,obj_block_ice) {exit;}
 rneighboor=noone;
 lneighboor=instance_position(bbox_left-1,y+16,box);
 if lneighboor=noone {x-=4; image_single=0;}
 else {if lneighboor.lmove {lneighboor.x-=4; x-=4; image_single=1;}}
}

Its for GM7.

It gives me this error.
QUOTE

___________________________________________
FATAL ERROR in
action number 2
of Keyboard Event for <Left> Key
for object obj_player:

COMPILATION ERROR in code action
Error in code at line 33:
  

at position 1: Symbol } expected.


Hlep, please?

This post has been edited by ndsfreak on Sep 6 2007, 09:12 PM


--------------------
user posted image
PMEmail PosterAOL
Top
Canada
DJ Yoshiman
  Posted: Sep 6 2007, 09:13 PM
Quote Post


My post is to the right.
[M][S][*][*][*]
[*][*][*][*][*]
[*][*]

Group Icon
Group: Moderators
Posts: 18175
Member No.: 141
Joined: 16-November 03

Status: (0d) [--]


I don't know Game Maker, but I know errors.


"COMPILATION ERROR in code action
Error in code at line 33:


at position 1: Symbol } expected."

The code only has 32 lines. They're saying at line 33, they're expecting a } symbol to be there. Try adding another } after the last one in that code, on the next line.


--------------------

user posted image

The Music of DJ Yoshiman - Official Website

Latest News:
I Like To Bonk It Bonk It

NUMBER OF TRIALS:
12
PMEmail PosterUsers WebsiteAOLYahooMSN
Top
Belarus
Ndsfreak
Posted: Sep 6 2007, 09:21 PM
Quote Post


Who wants a body massage?
[*][*][*][*]

Group Icon
Group: Members
Posts: 1993
Member No.: 2868
Joined: 28-October 06

Status: (0d) [--]


QUOTE (DJ Yoshiman @ Sep 6 2007, 06:13 PM)
I don't know Game Maker, but I know errors.


"COMPILATION ERROR in code action
Error in code at line 33:
 

at position 1: Symbol } expected."

The code only has 32 lines. They're saying at line 33, they're expecting a } symbol to be there. Try adding another } after the last one in that code, on the next line.

OK, I'll try that.
EDIT: Nope, it didn't work.

This post has been edited by ndsfreak on Sep 6 2007, 09:42 PM


--------------------
user posted image
PMEmail PosterAOL
Top
Unspecified
exenefevex
Posted: Sep 6 2007, 11:28 PM
Quote Post


Regular
[*][*][*]

Group Icon
Group: Members
Posts: 258
Member No.: 3660
Joined: 19-April 07

Status: (0d) [--]


I count four open brackets. I've got as much GM experience as DJ Yoshiman, but I think you simply forgot to close your first two else blocks.

CODE (oops... I can't use size tags inside a code block)
{
if place_meeting(bbox_left-1,y,obj_block_solid) {exit;}
rneighboor=noone;
lneighboor=instance_position(bbox_left-1,y+16,box);
if lneighboor=noone {x-=4; image_single=0;}
else {if lneighboor.lmove {lneighboor.x-=4; x-=4; image_single=1;}}
if place_meeting(bbox_left-1,y,obj_block_jumpthrough) {exit;}
rneighboor=noone;
lneighboor=instance_position(bbox_left-1,y+16,box);
if lneighboor=noone {x-=4; image_single=0;}
else {if lneighboor.lmove {lneighboor.x-=4; x-=4; image_single=1;}}
if place_meeting(bbox_left-1,y,obj_block_ice) {exit;}
rneighboor=noone;
lneighboor=instance_position(bbox_left-1,y+16,box);
if lneighboor=noone {x-=4; image_single=0;}
else {if lneighboor.lmove {lneighboor.x-=4; x-=4; image_single=1;}}
}

Never rely on the compiler to tell you where your brackets are missing. If you had placed }}}} on line 33, the compiler would have run the code... and who knows what would have happened next. :P

This post has been edited by xn--e5x on Sep 6 2007, 11:33 PM
PM
Top
Canada
MegaTailzChao
Posted: Sep 6 2007, 11:41 PM
Quote Post


So long, and thanks for all the fish.
[S][*][*][*][*]
[*][*]

Group Icon
Group: Site Staff
Posts: 15788
Member No.: 2267
Joined: 2-July 06

Status: (0d) [--]


Wow your coding style is even messier then mine.

But yeah what xn--e5x said, you just forgot to end your { tags. You also have an extremely unnecessary amount of them.


--------------------
user posted image
user posted imageuser posted image
PMEmail PosterMSN
Top
Unspecified
Bormogin
Posted: Sep 6 2007, 11:54 PM
Quote Post


Standard Member
[*]

Group Icon
Group: Members
Posts: 3195
Member No.: 1844
Joined: 29-January 06

Status: (0d) [--]


Let's try a little experiment here:

Hopefully this will be a little easier than codes and scripts,

1. For the character: Keyboard Left, If object "insert object" is at a postion, If sprite index "insert left sprite", then play sound "..."

(Have the character press left against the block, and play a sound)

(If you do not want a sound, you could lower the volume)

2. For the block: Collision with character or Step: if sound is playing, if sprite_index "object character", then move "insert point" relative.

(Define the sprite of the character and have the sound play, and move the block forward)

-------------------

When you release the key, stop the "sound"


--------------------
Super Mario IV: Vendetta of the Guillotine Mask is now permanently cancelled. I may start a new project.
PMEmail PosterYahoo
Top
Mexico
seldeslim
Posted: Sep 7 2007, 12:20 AM
Quote Post


so good that its banned
[*][*][*][*][*]
[*]

Group Icon
Group: Members
Posts: 4186
Member No.: 2016
Joined: 15-April 06

Status: (0d) [--]


forget codes, try this:

EVENT: Collision with object

ACTION: If left pressed (preferably 'vk_left'), then pushed object moves to the left

ACTION: If right pressed (preferably 'vk_right'), then pushed object moves to the right

also, when control object is in contact with object at certain position (left or right side of the pushed object) then change sprite accordingly...

NOTE: I'm telling you in logic form, OK?

This post has been edited by Fonki Yoshi on Sep 7 2007, 12:21 AM


--------------------
Tribute 1 BROWN mexican with forty years or less of AGE. Check all people your opponent controls, your opponent's hand, and all cards they draw (until the end of your opponent's third turn after this card's activation), and destroy all people with five or more years of AGE.

also this is gato from new mfgg3
just in case you're wondering about my join date status you silly newbies
PMUsers WebsiteAOL
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.0608 ]   [ 14 queries used ]   [ GZIP Enabled ]   [ Server Load: 4.36 ]