Topic:   More Questions   (Read 19143 times)


0 Members and 3 Guests are viewing this topic.

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
More Questions
« on: February 25, 2010, 06:08:53 PM »
Well, I tried to find it myself, but I still don't know exactly how to do collision checks in SC.
Can I get some help?? ???
« Last Edit: March 27, 2010, 04:07:59 PM by Connors »
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Xiphos


  • GMG-er

  • **


  • Posts: 676
Re: Collision
« Reply #1 on: February 25, 2010, 06:56:41 PM »
Code: [Select]
IF spritestouching(1,2) = true THEN

or something along those lines, btw I'm my iPod so forgive my mistakes!

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: Collision
« Reply #2 on: February 25, 2010, 07:08:45 PM »
Yes, actually i found that in the Mario example game after I posted this. It has good examples. (my bad! -_-). Of course, I can still use this post for ANOTHER question - isn't there some code that outputs the x or y of a specific sprite? (not just for collision purposes)
« Last Edit: February 25, 2010, 07:10:05 PM by Connors »
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

EqwanoX


  • Administrator

  • GMG Extraordinaire

  • *****


  • Posts: 1180
Re: Various Questions
« Reply #3 on: February 25, 2010, 07:49:32 PM »
spritex(spritenumber), spritey(number)

theres also IF spritetouchingxy(sprite, x, y)= true THEN, to see if a sprite is colliding with a specific coordinate

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: Various Questions
« Reply #4 on: February 25, 2010, 08:00:48 PM »
ok, thanks again! ;D I think I will be able to post a build of this game pretty soon now. There's a few more things I need to review but I think it's all in recent posts.
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: Various Questions
« Reply #5 on: February 26, 2010, 09:16:33 PM »
HEY i got a question - what code can you put into the "Mouse Move" area??
Can you control stuff with the mouse? that would be cool
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Xiphos


  • GMG-er

  • **


  • Posts: 676
Re: Various Questions
« Reply #6 on: February 26, 2010, 09:45:23 PM »
The code is executed when the mouse changes x or y position.

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Re: Various Questions
« Reply #7 on: February 27, 2010, 02:28:17 AM »
You could create the illusion of controlling the mouse by simultaneously hiding the curser and drawing a sprite that looks like it.
I survived the spammage of 2007

WarHampster


  • GMG Extraordinaire

  • ***


  • Posts: 1501

  • The People's Moderator
    • Arcade of the Absurd
Re: Various Questions
« Reply #8 on: February 27, 2010, 10:24:17 AM »
Can SC hide the mouse cursor yet?

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: Various Questions
« Reply #9 on: February 27, 2010, 07:00:47 PM »
Quote
You could create the illusion of controlling the mouse by simultaneously hiding the curser and drawing a sprite that looks like it.
Or you could see if things collide with the point mousex, mousey

BTW, I can't find out how to make SC respond to the spacebar or letters.
I tried IF key$ = space$.
« Last Edit: February 27, 2010, 07:01:24 PM by Connors »
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: Various Questions
« Reply #10 on: March 02, 2010, 06:52:13 PM »
I got a good question - I'm trying to find a good way to add a lot of sprites continuously without repeating the same sprite number. It's mainly to have enemies or shots enter the screen on command without causing a glitch. I'm gonna try a few things myself but I'm sure there's more than one way.
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: Various Questions
« Reply #11 on: March 02, 2010, 07:25:53 PM »
Quote
try this, basically if the sprite doesnt exist it creates it
 
for x=1 to enemies
if spritevalid(x)=false then
createsprite x, "enemy"
movesprite x, 1, 1
end if
next
Yeah, that works fine, but what if it makes more than 1 sprite? Can you make a FOR loop stop running?
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

EqwanoX


  • Administrator

  • GMG Extraordinaire

  • *****


  • Posts: 1180
Re: Various Questions
« Reply #12 on: March 02, 2010, 07:31:51 PM »
Quote
try this, basically if the sprite doesnt exist it creates it
 
for x=1 to enemies
if spritevalid(x)=false then
createsprite x, "enemy"
movesprite x, 1, 1
exit
end if
next
yea add "exit"

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: Various Questions
« Reply #13 on: March 02, 2010, 07:37:09 PM »
COOL thanks a lot!  8)
Now I can put this together even better.
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: Various Questions
« Reply #14 on: March 02, 2010, 09:41:37 PM »
I made some major changes to my project, a big one is I found out that using more than one timer makes it run faster. The thing is the UFO sprites aren't moving or colliding anymore. I think it's a problem with one FOR loop because they don't collide anymore either.
This is the entire open card section:
Code: [Select]
CREATESPRITE 1, "BG"
MOVESPRITE 1,0,0

CREATESPRITE 2, "Ship"
MOVESPRITE 2,100,180

LET enemies = 10
LET other = 4
LET shots = 1
LET numy = enemies+other

FOR x = 4 to 14
 Â  CREATESPRITE x, "UFO"
 Â  MOVESPRITE x, random(100)*20+700, random(300)
NEXT

ON TIMER 1
 Â 
 Â  IF fail = true THEN
 Â     
 Â     EXPLODE 2
 Â     STOPTIMER
 Â     
 Â  END IF
 Â 
END TIMER



ON TIMER 1
 Â 
 Â  FOR x = 4 to 14     //this seems to be broken
 Â     IF SPRITEVALID(x) = true THEN
 Â     PUSHSPRITE x, -8, 0
 Â     END IF

 Â     IF SPRITESTOUCHING(2,x) = TRUE THEN
 Â        LET fail = true
 Â     END IF
 Â     
 Â  NEXT
 Â 
END TIMER

ON TIMER 1
 Â 
 Â  IF fail = false THEN
 Â     PUSHSPRITE 1, -8,0
 Â     
 Â     IF spritex(1) < -2210 THEN
 Â        LET spritex (1) = 0
 Â     END IF
 Â     
 Â     FOR i = numy to numy+shots         //pushes shots
 Â       
 Â        IF spritevalid(i) = true THEN
 Â           PUSHSPRITE i, 10, 0
 Â        END IF
 Â     NEXT
 Â  END IF
END TIMER

(i will improve the code to create/push shots once I want them to actually do something, and they are created in the key down section)

EDIT: why must this be so hard? I thought I would be nearly done by now.
« Last Edit: March 02, 2010, 09:50:35 PM by Connors »
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/