Background / Sprite Collision

Download new sets of actions and learn how to make them yourself

Background / Sprite Collision

Postby turrican1024 » Thu Mar 04, 2010 7:59 pm

Is it possible to code something like this directly in dsgamemaker ?

if sprite collides with backdrop then action ? like jump sprite x,y / 0.2

the only one i found has background co-ordinates and doesnt make sense. And doesnt work either.

Andy
User avatar
turrican1024
 
Posts: 35
Joined: Mon Mar 01, 2010 1:10 am

Re: Background / Sprite Collision

Postby Metatarsals » Thu Mar 04, 2010 9:41 pm

See Eldudes collision background tutorial, in it he allows movement in directions unless the sprite is colliding with the black areas of the collision background (move if NOT touching black), you could add in 'if the pixel being touched is black' - do shizzle. Read through the tutorial first before asking questions about it.

Note; it may work slightly differently now that the views system is implemented, if you make the 'camera' move but the principle you are enquiring about is the action on collision, which it does illustrate well.
Building an Engine
User avatar
Metatarsals
 
Posts: 741
Joined: Sun Jul 26, 2009 5:38 pm
Location: Where Leprachauns doth lie
Current Project: PacMan E [Beta]

Re: Background / Sprite Collision

Postby Eldude » Fri Mar 05, 2010 12:45 am

turrican1024 wrote:the only one i found has background co-ordinates and doesnt make sense.
Metatarsals wrote:See Eldudes collision background tutorial,


Thats the one he can't make sense of! hehehe
If you do not like my post, PM me to let me know and I will edit it.
Available to program your game.(not help you program it)
PM me your proposals. I want to see graphics and story as a minimum.

My Scratch Page: http://scratch.mit.edu/users/Eldude
Image
User avatar
Eldude
 
Posts: 5795
Joined: Thu Jun 26, 2008 9:46 pm
Location: A good place!
Current Project: Coding for one of you!

Re: Background / Sprite Collision

Postby Metatarsals » Fri Mar 05, 2010 1:51 am

Is the tutorial non-compatible now Eldude? Or is this guy in over his depth?

There is an included example of collisions with DSGM, you could begin there. Or go the long way around, track and move your sprite with variables, and if those variables are within certain boundaries -- do something. Its not that complicated, but suited best to rectangular objects.
Building an Engine
User avatar
Metatarsals
 
Posts: 741
Joined: Sun Jul 26, 2009 5:38 pm
Location: Where Leprachauns doth lie
Current Project: PacMan E [Beta]

Re: Background / Sprite Collision

Postby turrican1024 » Fri Mar 05, 2010 2:43 am

Yes it does not work with 4.5 .. Im good with understanding how code works , but yes this is new to me.

Ive got to try it line by line and somehow change whats different. But I dont know whats different, so i dont know what to change.
User avatar
turrican1024
 
Posts: 35
Joined: Mon Mar 01, 2010 1:10 am

Re: Background / Sprite Collision

Postby Eldude » Fri Mar 05, 2010 6:06 am

turrican1024 wrote:Ive got to try it line by line and somehow change whats different. But I dont know whats different, so i dont know what to change.


Easy.

If what you are trying to add is different then that is what you need to change.
For example. Declare Global x;int;0 well int does not exist in the new version so this would need to be Declare Global x;Whole Number;0
If you do not like my post, PM me to let me know and I will edit it.
Available to program your game.(not help you program it)
PM me your proposals. I want to see graphics and story as a minimum.

My Scratch Page: http://scratch.mit.edu/users/Eldude
Image
User avatar
Eldude
 
Posts: 5795
Joined: Thu Jun 26, 2008 9:46 pm
Location: A good place!
Current Project: Coding for one of you!

Re: Background / Sprite Collision

Postby turrican1024 » Fri Mar 05, 2010 5:00 pm

OK re-typed everything and edited the declares to whole numbers.

It still has compile errors and found its when i try to use the new actions , load collision bg ..

Are you able to make it compatible Eldude ? V 4.5

PS:- i copyied the new actions into the actions directory in dsgamemaker.
User avatar
turrican1024
 
Posts: 35
Joined: Mon Mar 01, 2010 1:10 am

Re: Background / Sprite Collision

Postby Eldude » Fri Mar 05, 2010 5:22 pm

Don't use load collision background.

Use Change background average or what ever its called.

Load collision background uses an old palib command to load the background that does not exist anymore.
If you do not like my post, PM me to let me know and I will edit it.
Available to program your game.(not help you program it)
PM me your proposals. I want to see graphics and story as a minimum.

My Scratch Page: http://scratch.mit.edu/users/Eldude
Image
User avatar
Eldude
 
Posts: 5795
Joined: Thu Jun 26, 2008 9:46 pm
Location: A good place!
Current Project: Coding for one of you!

Re: Background / Sprite Collision

Postby turrican1024 » Fri Mar 05, 2010 5:43 pm

Well it compiled at least, but a get lost of flashing on 'advanced change bg average' and the screen just goes black with the sprite showing on 'change bg average quality' .

tried all the different layers and still no luck. Have you had this working on 4.5 ?

oh yeah and i had to delete the output text at the bottom, that failed i too.

cheers
THIS SCREEN SHOTS USING Change BG High quality action.... instead of average. but they both dont work.
Attachments
ss.jpg
preview
User avatar
turrican1024
 
Posts: 35
Joined: Mon Mar 01, 2010 1:10 am

Re: Background / Sprite Collision

Postby Eldude » Fri Mar 05, 2010 5:59 pm

turrican1024 wrote:Have you had this working on 4.5 ?


No I use 2.8!!

Played with my example in 4.5... it appears the views system stuffs up the background scrolling so this example does not work. Its a fine balance, DSGM has to be noobified so new users can make things with it but at the same time it disables other things.

Thats why I still use 2.8!!
If you do not like my post, PM me to let me know and I will edit it.
Available to program your game.(not help you program it)
PM me your proposals. I want to see graphics and story as a minimum.

My Scratch Page: http://scratch.mit.edu/users/Eldude
Image
User avatar
Eldude
 
Posts: 5795
Joined: Thu Jun 26, 2008 9:46 pm
Location: A good place!
Current Project: Coding for one of you!

Re: Background / Sprite Collision

Postby turrican1024 » Fri Mar 05, 2010 11:04 pm

Hi Eldude,

Im suffering the same problem with 2.8 ... only the declare global action was missing ... had to be changed to declare room global .... i had to change the load bg collision to change bg average.

also tried copying across a declare global action from a version of dsgm that had it. still No luck.

and had the same error as 4.5. what version of 2.8 are you using ? theres abcd.
User avatar
turrican1024
 
Posts: 35
Joined: Mon Mar 01, 2010 1:10 am

Re: Background / Sprite Collision

Postby Eldude » Fri Mar 05, 2010 11:09 pm

I use 2.8D.

You can't use the new version of palib/devkirpro with 2.8.
If you do not like my post, PM me to let me know and I will edit it.
Available to program your game.(not help you program it)
PM me your proposals. I want to see graphics and story as a minimum.

My Scratch Page: http://scratch.mit.edu/users/Eldude
Image
User avatar
Eldude
 
Posts: 5795
Joined: Thu Jun 26, 2008 9:46 pm
Location: A good place!
Current Project: Coding for one of you!

Re: Background / Sprite Collision

Postby turrican1024 » Fri Mar 05, 2010 11:22 pm

thanks, i'll try that .. yes im using the old versions.

ANdy,
User avatar
turrican1024
 
Posts: 35
Joined: Mon Mar 01, 2010 1:10 am

Re: Background / Sprite Collision

Postby turrican1024 » Fri Mar 05, 2010 11:58 pm

OK so it compiles ... but doesnt appear on the path , but rather stuck in a building.

moved him out the building .. tried the cursor keys and he stays still.

Ive had to copy the declare global actions from 4.5 as 2.8D doesnt come with it. Are you sure you didnt use version 1 ?? and thats no longer downloadable.

heres the XDS file .. theres no pack and go . i really dont know whats wrong with it.

I noticed all your button presses are if pads too.
Attachments
andycol.xds
please help
(3.29 KiB) Downloaded 4 times
User avatar
turrican1024
 
Posts: 35
Joined: Mon Mar 01, 2010 1:10 am

Re: Background / Sprite Collision

Postby turrican1024 » Sat Mar 06, 2010 4:21 am

I found i think is version 7 of Palib ... he now centres in the screen but still doesnt move.
User avatar
turrican1024
 
Posts: 35
Joined: Mon Mar 01, 2010 1:10 am


Return to Actions

Who is online

Users browsing this forum: No registered users and 1 guest